QUOTE=TRScheel]My notepad > your notepad?
Hehe, on a serious note, I have never noticed a problem viewing them. Something like:
-
StreamWriter SWriter = new StreamWriter("MyText.txt");
-
SWriter.Write("Test\nTest\nTest");
-
SWriter.Close();
-
Will produce a readable txt file for me.[/quote]
Although your program writes seemingly only a \n from a c program, the binary file produced actually contains carriage return + line feed (x'0d0a'), on a windows platform. You can see this with a binary editor (I use spf/pc with profile 'exe').
Also, if you open an ordinary text file in c with binary mode fopen(<filename>, "rb") and read it then with fread -function , you can see x'0d0a' in the buffer.
Moreover, after "r" -mode fopen(<filename>, "r"),
fread suppresses all 2-byte CRLF (0d0a) to 1-byte LF (0a).
so you can only see x'0a' in buffer.
Also, if you ask for a file length in a c-program with a
fseek(fileptr, 0, SEEK_END); byteCount = ftell(fileptr);
the bytecount is the real length of the file, i.e. including
x'0d0a', not x'0a' (\n) only.
On a unix it is only x'0a' line separator in a text file. If you transfer a file from unix having x'0a' line separators, at least my notepad (5.1 sp2) can't show them properly, instead you see one long stream with non-printable byte where the line separator should be. But wordpad can read it, and when you save it, you have
x'0d0a' so it adds the 'x0d'.