Code Conversion

Posted By: JimFox

Code Conversion - 06/18/11 19:57

Hello,
I have a piece of old code (C-Script) with the following command:

string is_sNpcLine[10000];

I can easily put it into Lite C as:
STRING* is_sNpcLine[10000];

But I have a sneaking feeling that the old code was intending to allocate a string of 10000 characters, not an array of 10000 pointers. If that was the case, then I should do this:
STRING* is_sNpcLine(#10000);

Does anyone remember the old C-script syntax well enough to say what the code represented?
Thanks for your help!!
Posted By: Myrkling

Re: Code Conversion - 06/18/11 21:56

Quote:
But I have a sneaking feeling that the old code was intending to allocate a string of 10000 characters, not an array of 10000 pointers.

Yep, you're right: In C-Script this will create a string with 10000 characters.

Actually string arrays are not possible in C-Script (unless you use a TEXT).
Posted By: djfeeler

Re: Code Conversion - 06/19/11 13:12

Hello,

if you want to allocate 10,000 characters in lite c must be :

Code:
STRING* is_sNpcLine = "#10000";



djfeeler
Posted By: JimFox

Re: Code Conversion - 06/20/11 16:55

OK, thanks everyone. That helps a lot. I will correct the code as you indicated.
Regards,
© 2024 lite-C Forums