text files

i'm working on a text file convertor, converting unix text files to windows text files and vice versa.

i know that the windows use carriage return (CR) and a line feed (LF) - to mark the end of the line

and unix uses only CR

first of all, am i wrong?
is CR - \n ?
and LF - \r ?
dafokiAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
graham_kConnect With a Mentor Commented:
you will find source for a progarm which doe sit at ftp://garbo.uwasa.fi/pc/unix/doscvt27.zip

There are any number of freeware programs to do this, so unless you really want to program it, I woul;dn't reinvernt the wheel.

See also    man dos2unix
0
 
graham_kCommented:
almost right. DOS = CR + LF, Unix = LF only.
0
 
dafokiAuthor Commented:
one more thing:
is CR = \n ?
and NF = \r ?

and in windows does it come \r\n or \n\r ?
0
 
graham_kCommented:
yes, but you can check it all in the source code whose URL was provided.

Happy coding,

~Graham();
0
All Courses

From novice to tech pro — start learning today.