[fpc-pascal] Strings greater than 255 characters

James Richters james.richters at productionautomation.net
Tue Dec 19 12:36:05 CET 2023


I keep getting bit by using STRING variables then trying to store more than
255 characters.  
My typical way to fix this is to just change it to an ANSISTRING.
 
I'm wondering if there is any reason not to do this the other way around and
just go through
My entire program and replace all the STRING variables with ANSISTRNG?  It's
likely that 
I would solve a lot of future problems that I don't even know I have yet if
I did this. 
Is there any reason not to change all the Strings to Ansistrings?
 
I did notice that I cannot have a file of Ansistrings. 
 
Myfile : File of Ansistring;  
Causes a compiler error:
Error: Typed files cannot contain reference-counted types.   
 
So maybe this could be a problem.  Is there a way to make a file of strings
that are not limited to 255 characters?
 
Also I can make records that contain Ansistrings, but I can't make files of
those records, for the same reason as above.
 
James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20231219/8d0e6e1d/attachment-0001.htm>


More information about the fpc-pascal mailing list