It is represented by either one or two characters in a file, depending on the operating system under which the program is running. Under DOS, it is represented by a "carriage return" (ascii 13) followed by a "line feed" (ascii 10), while under Unix it is represented by just a line feed character. The names of these characters are historical artifacts from the era of teletypewriters. <>"\n" actually is the name of the newline character, no matter which representation it is written in. You can also write "\t" for a tab character or "\b" for a space character, but those are again names of single characters.(posted 8295 days ago)
To put a newline in a file, we write it explicitly by using the "\n" or "endl".
It is definitely not a null byte. Null bytes can't be read by normal C input functions, again for historical reasons.
Yes, the input function for the Stockitem class assigns them in the same order that the function that wrote them puts them out, and we need to ensure that the same order is maintained for the variables in both.
[ Previous | Next ]