string - ReadLn from file >255 chars in pascal -


i trying read lines longer 255 chars file pascal line line. not allowed read char char , glued standard settings of free pascal compiler. can achieve that? possible? read hints using blockread wasn't able find enough information clue how it's done.

i open suggestions though long fulfill restrictions.

thank in advance cheers -gladston3

i don't quite see problem. works (lazarus/freepascal on windows 7):

program project1;  const   filename = 'test.txt';  procedure writelonglines; var   s: string;   t: text; begin   s := stringofchar('#', 350);   assign(t, filename);   rewrite(t);   writeln(t, s);   writeln(t, s);   writeln(t, s);   close(t); end;  var   t: text;   s: string;  begin   writelonglines;   assign(t, filename);   reset(t);   while not eof(t)   begin     readln(t, s);     writeln(length(s), ' ', s);   end;   readln; end. 

the lines 350 characters in length (i.e. > 255). can read without problem. did not change of standard settings.

lazarus v1.6 2016-02-14, fpc 3.0.0.

just tried on os x. works fine too. , works fine in ubuntu 16.04.

hmmm... don't tell me using short strings (max 255 chars)?


Comments