0
(gdb) b main
Breakpoint 1 at 0x804869e: file whodunit.c, line 18.
(gdb) r infile outfile
Starting program: /home/jharvard/Dropbox/pset5/bmp/whodunit infile outfile

Breakpoint 1, main (argc=3, argv=0xbffff094) at whodunit.c:18
18      if (argc != 3)
(gdb) n
25      char* infile = argv[1];
(gdb) 
26      char* outfile = argv[2];
(gdb) 
29      FILE* inptr = fopen(infile, "r");    
(gdb) 
30      if (inptr == NULL)
(gdb) 
32          printf("Could not open %s.\n", infile);
(gdb) 
Could not open infile.
33          return 2;
(gdb) info locals
infile = 0xbffff286 "infile"
outfile = 0xbffff28d "outfile"
inptr = 0x0
2

Are your files actually named infile and outfile?

Shouldn't you be running it with clue.bmp and verdict.bmp as the problem set describes?

./whodunit clue.bmp verdict.bmp

In gdb, that means this:

(gdb) r clue.bmp verdict.bmp
2
  • Thank you... that's all it is! – CiscoVet Nov 2 '14 at 19:53
  • Glad to help. You might want to 'accept' my answer so others know it solved the problem. – curiouskiwi Nov 2 '14 at 22:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .