Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 210
  • Last Modified:

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 ?
0
dafoki
Asked:
dafoki
  • 3
1 Solution
 
graham_kCommented:
almost right. DOS = CR + LF, Unix = LF only.
0
 
graham_kCommented:
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
 
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now