Read 0 terminated string from memory

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Berikco.

Code: Select all

result = MemoryStringLength(@buffer$ + 73) 
msgfile$=Space(result)
CopyMemory(@buffer$ + 73, @msgfile$, result) 
Debug msgfile$
Is there another - shorter - way to do this, copy a nul terminated string from a memoryposition ?
Like this?

Code: Select all

msgfile$ = Char(@buffer$ + 73)
Regards,

Benny

http://www.benny.zeb.be
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

> msgfile$ = Char(@buffer$ + 73)

Do this: msgfile$=PeekS(@buffer$+73)


PB - Registered PureBasic Coder
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Berikco.
Originally posted by PB

> msgfile$ = Char(@buffer$ + 73)
Do this: msgfile$=PeekS(@buffer$+73)
Thanks PB

I think a had to much beer last night :)

but... why do it easy...if there is a difficult way to do it :)

Regards,

Berikco

http://www.benny.zeb.be
Post Reply