Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2002-06

unix EOF

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Cyril Zlachevsky
I try to find correct way finding end of file (EOF) in fpc-program, but
not have success:
---cut ttt.pp---
var
     f           :       file of char;
     TmpChar     :       char;
begin
     TmpChar:=' ';
     Assign(f,paramstr(1));
     Reset(f);
     while (TmpChar  #26) do read(f,TmpChar);
end.
---cut ttt.pp---

---cut---
$ ./ttt ttt.pp
Runtime error 100 at 0x08052164
0x08052164
0x080480B0
0x00000000
---cut---

please help me to find right way!

Michael Van Canneyt
to Cyril Zlachevsky: I try to find correct way finding end of file (EOF) in fpc-program, but not have success:…
Cyril Zlachevsky wrote 11 lines
I try to find correct way finding end of file (EOF) in fpc-program, but not have success: ---cut ttt.pp--- var f : file of char; TmpChar : char; begin TmpChar:=' '; Assign(f,paramstr(1)); Reset(f); while (TmpChar #26) do read(f,TmpChar);

On Unix, files are not terminated with CTRL-Z. use

While Not EOF(F) do read (f,TmpChar);

Michael.