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?
Hello!
On Mon, Feb 16, 2004 at 11:52:57 -0800, Daniel Rudy wrote:
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.
Try using:
uses GPC;
in your program.
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?
program Foo (input, output); {...} begin Reset (input); ReWrite (output); while not EOF (input) do begin ReadLn (input, LineOfText); WriteLn (output, LineOfText) end; { ... } end.
Eike Lange wrote:
Hello!
On Mon, Feb 16, 2004 at 11:52:57 -0800, Daniel Rudy wrote:
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.
Try using:
uses GPC;
in your program.
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?
program Foo (input, output); {...} begin Reset (input); ReWrite (output);
Omit those two lines. `Input' and `Output' are automatically provided (GPC also provides `StdErr' as an extension).
Only if you need other files to be connected to standard input/output, you can open them to '' or '-' (both mean the same), but that's only necessary in rather special circumstances.
while not EOF (input) do begin ReadLn (input, LineOfText); WriteLn (output, LineOfText) end; { ... } end.
Frank
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