Please put your code in tags, yourself. I ain't yo mama.

You say your code doesn't seem to want to dump the file. What does that mean? What errors are you getting? If you don't know what errors you are getting, use a debugger, or sprinkle some printf statements around that provide some relevant information. Guessing isn't an effective troubleshooting method.

On another note: your compiler might clear the input stream with fflush (stdin), but a standards compliant compiler will not. Your program may cease to work with the next compiler version.

C and C++ are really bad in this regard, though C++ does provide an ignore function. The best way to handle this reliably in C is to repeatedly read characters from the stream until you get a newline or an EOF. Notice, however, that if there is nothing in the stream, this operation will block, and you're screwed. To prevent that happening, use ungetc to put a character back into the steam, and then read until you get a newline or an EOF.