Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

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