Hi everyone,
I apologize if this subject has been discussed already, but since I could find no mention of it on either the GPC to-do pages or in the mailing list archives I thought that I would bring it up.
I know that the current GPC string standard has no length limitation, but do you have to define the max length when declaring varaiables? And if so, why? One nice thing about Delphi's "AnsiStrings" is that they are dynamically assigned their length based on the length of the string assigned. Also, they are reference counted so that copies of a string do actually take up memory.
The reason that I am wondering about this is that I am writing a small unix utility that needs to parse file names (with path in some cases) and so I need strings long enough to accomodate these names. However, I don't want to be wasting memory declaring for example,
strWork : String(2048);
just to hold "HelloWorld.c" or even "/home/user/HelloWorld.c" but still be able to take care of those evil ones like "/usr/X11R6/lib/X11/shared/icons/samples/commercial/YourFriendlyNeighborhood ComputerGuy.txt" as an example (ok, a stupid one, but...).
Is there a way to do this with existing GPC strings? If not, what about supporting Delphi's string type that would allow
strWork : String;
and still accomodate any string needs up to available memory?
Larry Carter lcarter@hbtn.portland.or.us