[OCLUG-devel] Trouble with strings and files

James Colannino james at colannino.org
Tue Jul 6 19:59:16 PDT 2004


Hey everyone.  One of the programming excercises in my C book asked me 
to write a program that will take numbers from a file, place all the 
numbers divisible by 3 in one file, and all the numbers not divisible by 
3 in another file.  I wrote a program that compiles without any fatal 
errors (albeit I do get some warnings; I will post if asked), but when I 
run the program with the correct number of arguments, it seg faults.  I 
ran strace on it to see what it was failing on, but had trouble locating 
the exact problem.  Below are URLs pointing to both the C source and 
strace's output:

http://james.colannino.org/mailinglist/strace.output
http://james.colannino.org/mailinglist/twolist.c

I'm sure there's some blatantly obvious and stupid thing that I'm doing, 
but for the life of me, I can't figure out what it is.  I'm hoping that 
someone more experienced can hit me over the head with the correct 
answer :)  Thanks very much in advance.

James
-- 
My blog: http://www.crazydrclaw.com/
My homepage: http://james.colannino.org/

"There are no uninteresting things; only uninterested people." --G.K. 
Chesterton



More information about the OCLUG-devel mailing list