Subj : Help with "C++" to Pascal Conversion To : Scott Little From : Thomas W. Mueller Date : Tue Feb 26 2002 12:47 pm Hello Scott. 26 Feb 02 16:36, you wrote to Scott Adams: SA>> Either the array works or the standard String[] since SA>> that can be accessed by characters like string[4] SL> Depends if it needs to be compatible with files written in C. SL> Strings are [1..255] and the 0th byte is the length. IIRC, C only SL> uses null-termiated strings. SL> If it's being ported to Virtual Pascal, I think AnsiStrings are C SL> compatible. No, they aren't, at least not in a file. An AnsiString is actually a pointer to a structure like this: [4 bytes length] *pointer points here* [String contents][terminating zero] Somewhere in front of the length there is also the reference counter, but I don't recall exactly where, probably just another 32 bit integer. Also note, that empty strings are just NIL pointers. Since the contents is zero terminated (but the contents still start at string[1]), it can be typecasted to a PChar and passed to any C function that expects a (char *). But even there is some compiler magic that handles empty strings (remember: NIL pointers) by letting them point to a (static) valid empty PChar. Thomas --- GoldED+/LNX 1.1.4.7 * Origin: (2:2454/917) .