I just want to know how to use gdb if I want to see the value of my variable, that I get from a file.
To make it clear I will give an example:
lets say I have a file 'str.txt'
and a program that counts the word "daniweb".
to just run this program I would type something like this:
$ program.c < str.txt > program
and it would give a result lets say 5
So my question is how can I debug my program with this file
I want to get something like this:
gcc -g program.c -o program ... (gdb) s (gdb) p count = 3 // count is counting word daniweb