0

When we write code for online competition platforms, they read the test files as below

./a.out < test1

In the program we have cin statements which read the data from test1

Can this be run with gdb and still read the test in above manner automatically.

If this is not possible, then what best method can we use to debug this.

It is difficult to manually provide test data to the program.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278

1 Answers1

2

This is answered here:

$ gdb a.out
(gdb) run < test1

You find more information in the "Debugging with GDB" doc here.

Avi
  • 1,231
  • 10
  • 23