How can notepad recognize newline characters entered through code

When I create a text file through code using file handling functions, notepad doesn't seem to recognize the newline character. But, when I open the text file using a more advanced text editor (Notepad++ / Word), the newline characters are displayed.

Is there a way where we could make sure that Notepad displays newlines correctly?
Thanks!
dshrenikAsked:
Who is Participating?
 
brb6708Connect With a Mentor Commented:
your code has to end a line with CR NL instead of NL only. Then notepad can use it correctly.
0
 
dshrenikAuthor Commented:
So this is the string that I must write: "\r\n"?
0
 
brb6708Connect With a Mentor Commented:
that's right.......

\r is decimal 13 or hexadecimal x\0d or octal \015
\n is decimal 10 or hexadecimal x\0a or octal \012
0
All Courses

From novice to tech pro — start learning today.