so im writing this program, that is similar to the linux/unix sort program...
everything was going fine, in my testing phase... giving it random inputs, from a file...
a.out < test
and boom,
%
(i enter control C here because it hangs)
%
oddly enough, this only happens for certain inputs.
trying to debug my program, still hours later, im at the point where i have it printf("START") after my opening brace.
the file "test" contains lines of random #'s and letters, and my program sorts them.
as i understand the way executables work, since my program works most of the time, and compiles, when i run it shouldnt it print "START" regardless what is in the test file?
i mean, i give input 4 6 5, and it prints START 4 5 6, but then i give 4 0 6, and it prints nothing!! not even START. and printf is the very first statement. my program has not even begun to check the standard input and yet it hangs.
THEN, i make a minor modification, instead of printf("START"); i put printf("START\n"), and it prints START with a new line!! yet it still seems to hang, but regardless i dont understand... why does it print START only when its followed by a newline??
I realize i may be asked to show the offending code, but just in general, why would this occur? when i type a.out < test, is my program processing the test file before it actually runs the program??
i really hope someone can give me some insight on what is going on...
thanks!