I have the following problem. This program should get a filename as its 1st argument, and then try to open it. If it doesn't get an argument, or the argument is a nonexistent file, then it will ask for a filename until it gets one, that is an existing file. After that, it should print out the first line of that file.
Now, it does this, except... if i first give it a false filename, and then a good one, it seemingly opens the file, but prints out nothing... like the file is empty, but it isn't. If i rerun the program, give it a valid filename the first time, then it writes out the first line correctly.