the end of line in windows is "\r\n" where as in Unix it is \n
im using .net to write a text file and i need the lines to be coded in Unix - ( i need them to be readable in Unix)
how can i write a text file with end of line \n so that it can be readable in Unix?
writing a text file with lines coded in Unixwriting a text file with lines coded in Unix
Page 1 of 1
3 Replies - 6513 Views - Last Post: 16 January 2009 - 08:37 AM
Replies To: writing a text file with lines coded in Unix
#2
Re: writing a text file with lines coded in Unix
Posted 16 January 2009 - 07:56 AM
See String.Replace Method (String, String)
This post has been edited by n8wxs: 16 January 2009 - 07:59 AM
#3
#4
Re: writing a text file with lines coded in Unix
Posted 16 January 2009 - 08:37 AM
ghinwa, on 16 Jan, 2009 - 08:48 AM, said:
how can i write a text file with end of line \n so that it can be readable in Unix?
First, the pair is CR(13) and LF(10). When you say "\n" on a windows based system, you'll get CR+LF. When you say "\n" on *nix you get LF. The "\n" and "\r" aren't required to be mapped to a specific ASCII char.
If you're translating for Unix, you can simply remove all the CR. Or, if you're creating the file yourself, just send LF and use writes instead of write lines.
This post has been edited by baavgai: 16 January 2009 - 08:38 AM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|