Recently, I've been working with taking input from files and putting the output into another file. The problem I've been having is that when I put a newline character into a file using the fputc statement, it just prints a square box (the visible representation of the newline character, I guess?) instead of a new line. Here's a little snippet of what I'm doing that causes this.
It does the same thing with the fprintf statement.
Any ideas as to why it won't just start a new line instead of putting a square box there?
It doesn't put a box. That's the fault of whatever you're using to view your file.
If you're in Windows then try this instead:
Just add the line that sticks the '\r' in there before the line that sticks the '\n' in there.
If you open the file in text mode (on a windows machine), then \r should be stripped when you read it, you'll only see \n and it will be added when you print a \n (\r\n appears in the file).