Board index » delphi » Null-terminated block of null-terminated strings
Bjoern Stensrud
![]() Delphi Developer |
Sat, 01 Jan 2000 03:00:00 GMT
|
Bjoern Stensrud
![]() Delphi Developer |
Sat, 01 Jan 2000 03:00:00 GMT
Null-terminated block of null-terminated stringsHi! Can anyone assist me in making a "null-terminated block of After some fiddling, this worked: var I can't understand why I have to null-terminate strings that alreay - Bjoern ----------------------------------------------------------------------- |
Rob Power
![]() Delphi Developer |
Sat, 01 Jan 2000 03:00:00 GMT
Re:Null-terminated block of null-terminated strings Bjoern Stensrud wrote in article <33CBA596.6...@idt.ntnu.no>... Quote>Hi! of an array of strings back & forth. It avoids the necessity of using a callback function to do exactly the same thing but with much more work. Remember how strings are represented in C. You have a buffer that has The Delphi long string type does not have null termination outright (normal So assuming you're using Delphi 2/3, here's what you can do... var Likewise, with functions that return a "null-terminated block of Hope this helps, ------------------ |
Sundial Servic
![]() Delphi Developer |
Sat, 01 Jan 2000 03:00:00 GMT
Re:Null-terminated block of null-terminated stringsQuoteIn article <33CBA596.6...@idt.ntnu.no> Bjoern Stensrud <bjoer...@idt.ntnu.no> writes: logically =no= terminating null-byte in the string's value. Never mind that in D2/D3 there's always gonna be a zero-byte following the value; that null is not part of the string's value itself. This is why the value of S[0] does not include the terminating null byte. The Delphi "string" type is not the same as the C/C++ "null-terminated array So if you want to create a string containing a bunch of values followed by |
Serge Sush
![]() Delphi Developer |
Sun, 02 Jan 2000 03:00:00 GMT
Re:Null-terminated block of null-terminated strings Hi, Bjoern Stensrud! On Tue, 15 Jul 1997 18:30:14 +0200 you wrote: Quote>Can anyone assist me in making a "null-terminated block of Have a look: If you were a compiler, how would you interpret s[0] + s[1] statement? You would think that a programmer wants to have a string as a result => you have to remove the #0 character from the end of s[0]. So, your method is quite right, IMHO. Yours, |