Converting File Formats (Unix to Windows)

  • Thread starter Thread starter VC
  • Start date Start date
V

VC

Hi,
Greetings. Not sure if this is the right forum..... In case I should visit
some other forum please let me know.

Does Dot.NET provide a quick method/way to convert a UNIX text file to DOS
format?

Cheers!!!
V
 
The short and sweet of it is, Unix text files use "\n" (LineFeed) for CRLFs.
Windows uses "\r\n" (CarriageReturn-LineFeed). Simplest explanation is,
replace "\n" with "\r\n".

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

A lifetime is made up of
Lots of short moments.
 
Thanks for your time Caller and Kevin. Appreciate it much.
I guess I have to do it the "Simple" way.... and replace "\n" with "\r\n"...

Cheers!!!
V!
 
Hello Kevin,

I'm commenting here without testing... but:
I do believe the StreamReader.ReadLine() function will read a single line
from a unix-encoded text file. So open the unix filestream in Read mode..
open an output filestream in Write mode.. and then in a loop do something
like:
Writer.WriteLine(Reader.ReadLine())

-Boo
 
Yes, you are correct. The ReadLine() function detects the type of line feed
used by the file, and reads the line excluding the line feed. This is also
an excellent way to accomplish the task.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

A lifetime is made up of
Lots of short moments.
 
Back
Top