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? -- Daniel Rudy
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. -- Didaktik der Physik; Uni Duisburg-Essen; Universitätsstr. 2; 45117 Essen Tel (0201) 183 - 2575 ; Fax (0201) 183 - 2466 http://www.gnushi.de
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 -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html GPC download signing key: 51FF C1F0 1A77 C6C2 4482 4DDC 117A 9773 7F88 1707
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
participants (4)
-
Daniel Rudy -
Eike Lange -
Ernst-Ludwig Bohnen -
Frank Heckenbach