\r \n \f

  • Thread starter Thread starter trinitypete
  • Start date Start date
T

trinitypete

Hi all,

I have recently been working on a C# project that creates
a textfile with some formatting. Initially for a newline I
tried using \n. The result of this is that a tiny square
(non printable character) is placed in the output file
(also works the same with a multiline textbox). It does
however work if use the "\r\n" string. Anyone know why \n
doesn't get translated as a NewLine.

Further to this I try to throw a FF in the text file. I
have tried \f, \u000C, char(12) etc. etc. all variations
put in the little square (see above) and the printer does
not FF? Any ideas?

Thanks in advance - Pete.
 
On most Windows apps, they require a \r\n for a newline. Otherwise they
show that little square. This is a problem with your viewing app, as the
..NET Framework is writing out whatever you tell it.

-mike
MVP
 
trinitypete said:
I have recently been working on a C# project that creates
a textfile with some formatting. Initially for a newline I
tried using \n. The result of this is that a tiny square
(non printable character) is placed in the output file
(also works the same with a multiline textbox). It does
however work if use the "\r\n" string. Anyone know why \n
doesn't get translated as a NewLine.

It does - that's the non-printable character in the file. It's just
that what you're using to read it (notepad?) doesn't understand it.
Other editors may well understand it, and decide the text file was
created by a Unix variant.
Further to this I try to throw a FF in the text file. I
have tried \f, \u000C, char(12) etc. etc. all variations
put in the little square (see above) and the printer does
not FF? Any ideas?

Don't know about that one - how are you sending the text file to the
printer?
 
Back
Top