No Limitation in Writing Text file

The original Topic, started by Joseph Mathew has been closed so I have to open a new one. The following code snippet gives a short introduction on how to write text with “infinite” length: Given are the following variables:


f : file; opened with 
f.writemode(true);
f.textmode(false);

Procedure WriteBinary writes a string (maximum 250 bytes) into the file. Optionally you can indicate whether or not a CRLF should be added:


Procedure WriteBinary(
    VAR f : file;
        st = TExt250;
        withCRLF : Boolean)
//local variables:
i : integer;
ch : Char;

Begin
  FOR i := 1 TO STRLEN(st) DO BEGIN
    ch := st[i];
    f.WRITE(ch);
  END;
  IF withCRLF THEN BEGIN
    ch := 13;
    f.WRITE(ch);
    ch := 10;
    f.WRITE(ch);
  END;
End;

The code above is quick and dirty and not syntax-checked. However It gives an idea and I hope it’s not too bad for 1 AM in the night. ------- With best regards from Switzerland Marcus Fabian