Why not add a flag, for example #PB_Ascii | #PB_NoZero, so trailing zeroes are left out when we don't want them?PokeS(*MemoryBuffer, Text$ [, Length [, Flags]])
Flag for PokeS() to suppress trailing zeroes...
Flag for PokeS() to suppress trailing zeroes...
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Yep, it'd be a good idea to implement such a feature. I often thought about an easy to use command that allows you to poke somewhere in the middle of a string, without cutting this string because of the stupid NULL.
Of course, there would be for example the way via pointers, but why not having a more comfortable way?
Of course, there would be for example the way via pointers, but why not having a more comfortable way?
PB 4.30
Code: Select all
onErrorGoto(?Fred)
Re: Flag for PokeS() to suppress trailing zeroes...
Wouldn't this do the same thing, except without the benefit of flags?blueznl wrote:Why not add a flag, for example #PB_Ascii | #PB_NoZero, so trailing zeroes are left out when we don't want them?PokeS(*MemoryBuffer, Text$ [, Length [, Flags]])
Code: Select all
CopyMemory(@Text$, *MemoryBuffer, Len(Text$))
- tinman
- PureBasic Expert
- Posts: 1102
- Joined: Sat Apr 26, 2003 4:56 pm
- Location: Level 5 of Robot Hell
- Contact:
Re: Flag for PokeS() to suppress trailing zeroes...
You lose the string conversion option (e.g. Unicode->ASCII) if you use CopyMemory(). Or is that what you mean by "without the benefit of flags"?Demivec wrote:Wouldn't this do the same thing, except without the benefit of flags?Code: Select all
CopyMemory(@Text$, *MemoryBuffer, Len(Text$))
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
(WinXPhSP3 PB5.20b14)
Re: Flag for PokeS() to suppress trailing zeroes...
Yes that is what I meant.tinman wrote:You lose the string conversion option (e.g. Unicode->ASCII) if you use CopyMemory(). Or is that what you mean by "without the benefit of flags"?Demivec wrote:Wouldn't this do the same thing, except without the benefit of flags?Code: Select all
CopyMemory(@Text$, *MemoryBuffer, Len(Text$))
I guess you could include the "flags" for conversion by using:
Code: Select all
PokeS(*WorkBuffer, Text$ [, Length [, Flags]])
CopyMemory(*WorkBuffer, *MemoryBuffer, MemoryStringLength(*WorkBuffer [, Flags]))

Ah... not Unicode friendly!CopyMemory(@Text$, *MemoryBuffer, Len(Text$))

I wrote my own little PokeS() variant to avoid writing that terminating zero in fields where there is not enough space, what's throwing me off-balance all the time is that you specify how many bytes to write, and then PureBasic sneakily


It's just a request, it's not on the top of my want list

( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )