On Mon, 16 Feb 2004, Daniel Rudy wrote:
Hello,
I'm trying to build a program under Unix, and I'm trying to use stdin and stdout to do this, but it keeps telling me that the symbols are not defined.
I've tried stdin, stdout, standardinput, standardoutput, and used filenames such as 'stdin' and 'stdout'. How does one transfer information between stdin and stdout on unix systems through GPC?
This example program allows to read/write from standard in/out ('-') or real files ('filename'). This gives full remote control on source and destination. Please note: EOF works on line basis, after EOL. Writeln (StdErr, 'error') writes to standard error output, no need to open or assign StdErr.
Program ttt; var fn_in, fn_out : string (100); f_in, f_out : text; s : string (100); BEGIN fn_in := '-'; assign (f_in, fn_in); reset (f_in); fn_out:= '-'; assign (f_out, fn_out); rewrite (f_out); while not eof (f_in) do begin readln (f_in, s); writeln (f_out, s) end; close (f_in); close (f_out) END. {test done with gpc version 20030830, based on gcc-3.2.3 }
Ernst-Ludwig