On Sun, Aug 29, 1999 at 11:41:42PM -0700, Russ Whitaker wrote:
Hello,
Your program is doing exactly what you told it to do You defined a CString which begins byte1 = H, byte 2 = e, etc., disabled error detection with {$X+} and then called it a string: first 4 bytes is capacity, next 4 bytes current length, then the string bytes
[...]
So take out the {$X+} and use functions CString2String and String2CString where you need them.
Yes, this seems to be exactly what I need. Like I said in my original message it was just a case of me misunderstanding how the different string types cooperate -- and I mistakenly thought that straight CString := String assignments worked in a previous gpc version.
Also the reason I was really using {$x+} is so I could do unaltered writelns, e.g. you can writeln a CString without passing it through CString2String. The error message when you do this more or less suggests {$x+}, so I just plugged it in there. The side effect as you point out was that it also wasn't telling me that I was mangling my strings.
Also is {$x+} really error detection off? I thought it was for eXtended syntax? Regardless, it let me throughly &#*@ up my strings.
Is there a guide to all of the different String functions for conversion and what not?
Also noticed the function twine in the interface doesn't match function twine in the implementation. It didn't trigger an error message but I don't know if that's a bug or a extended pascal "extension".
Um, I thought it was exactly how EP was supposed to work, you define all of the argument and return types in the interface and just give the function name in the implementation.
In the rewrite which follows couldn't return a CString so changed it to a string. Think this is a language restriction. ( However it could be me )
This is weird, my own rewrite of the interface works fine returning CStrings, had no problem. You have to fix the 'twine :=' line in the module and the writeln in the main program.
Thanks for all the help,
-Kevin