\r \n \f

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.
 
M

Michael Giagnocavo [MVP]

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
 
J

Jon Skeet

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top