Sharpiedeluxe
September 13th, 2008, 09:50 AM
Okay, so I'm writing this program, and basically I want to test it with a bunch of text files, and make sure that the output is valid. So, I've been using
$ a.out < test.file > test.output 2> test.error
this is correct right? However, when I compare files, it appears that test.file is completely blank with nothing inside, as if it wasn't even taking stdin at all. However, if I run the program, immediately it prompts for input. Any suggestions? the code generally looks like:
while (!cin.eof())
{
cin >> user_data;
cin >> user_data2;
}
this is the only thing in the code that I would see a problem with :( Any help would be great. Thanks.
edit: Just found out that I get this if I output to an error file "<stdin>:106: warning: no newline at end of file", unfortunately, if its complaining about line 106, that's right in the middle of some code, so adding more lines doesn't help.
$ a.out < test.file > test.output 2> test.error
this is correct right? However, when I compare files, it appears that test.file is completely blank with nothing inside, as if it wasn't even taking stdin at all. However, if I run the program, immediately it prompts for input. Any suggestions? the code generally looks like:
while (!cin.eof())
{
cin >> user_data;
cin >> user_data2;
}
this is the only thing in the code that I would see a problem with :( Any help would be great. Thanks.
edit: Just found out that I get this if I output to an error file "<stdin>:106: warning: no newline at end of file", unfortunately, if its complaining about line 106, that's right in the middle of some code, so adding more lines doesn't help.