How to bind stdin of a console program to a text file?
- Lazarus/FPC Version: latest
- Operating System: w10
- CPU / Bitness: 64
What happens
I want to debug a console program that is supposed to read from stdio (like a school test).
How can I achieve this?
In Free Pascal IDE I can put < stdin.txt
in run parameters and the program runs as intended unless debugger is on. Unfortunately the debugger hangs in this mode for me.
In VSCode I can run a shell script that runs the compiled program with the < stdin.txt
parameter explicitly. Unfortunately no debugger this way either.
What did you expect
Some way to redirect console stdin to read from a text file.
Steps to reproduce
E.g. being able to put a breakpoint to the line with a Writeln
and see what is read from the stdio when bound to a text file.
var
N: integer;
begin
readln(N);
writeln(N);
end.
Edited by duzenko