I search a unit to solve the turbo pascal 255 string limit

62 Views Asked by At

is there a framework/unit that I can fill with strings to solve the 255 string limit?

Example with a loop

MyStringAllwaysWithOneString := 'X';

for i := 0 to CompleteStringLength do
begin
  255NoLimitUnit :=   255NoLimitUnit + MyStringAllwaysOneString;
end;

Then The same to read the 255NoLimitUnit. Delphi and FreePascal work with longer string too.

Or anybody other tipps? A way is to write a file byte per byte. But there is a time problem I think.

1

There are 1 best solutions below

0
Marco van de Voort On

The classic workaround is going to a more lowlevel stringtype "pchar", which is a pointer to char and more C like string routines. So that invalidates all normal string[] operations, and one must work with the pchar specific routines in the strings unit.

An additional complication IIRC is that TP doesn't support writing pchars using write, so you might need to use blockwrite for that, with some textrec<>file hacking.

In general, if you still insist on TP, make sure you get the SWAG archive with examples and study it thoroughly.

If you do this for performance reasons, have a look at settextbuf

(or just use Free Pascal)