I'm writing a program called "peek" that takes a couple of parameters, such as a file, and displays a bit of the file. The code looks like it will work, but when I run it, even without arguments, I get a "Segmentation Fault" message instead of what its supposed to print out.
I tried to debug it with GDB but it doesn't seem to want to tell me anything useful. It tells me the error, but beyond that, it doesn't tell me much else. I can't do a backtrace as the problem seems to be in the main() function. I think it has something to do with the file functions, but I'm not sure.
This program is written in C, and uses the functions "fopen, fclose, fgets, atoi, printf, strcat"
Compiled with "gcc peek.c" and puts out "a.out"
Executed with "./a.out <arguments>"
I'll show source code as a worst-case scenario, but I'm the kind of person who is reluctant to do so... I've had some bad experiences with that...
Thank you so much in advance for any help.
~osmiumusa
