Changing Unix <CTRL>M to DOS
I have an application that does a "shell" call that opens a cygwin shell and then creates a file from that cygwin shell. As would be expected, the file is created using the Unix <Ctrl>M character as the new line feed. Therefore, when the file is opened (by the same application) later in the application, it sees the contents of the file as a single line.
That said, what I would like to accomplish is to convert the Unix line feeds to the DOS environment. Is there anyway within VB this can be accomplished?
I'd appreciate any suggestions . . .
Thanks,
kgk
[597 byte] By [
kgkidd] at [2007-11-11 6:53:33]

# 1 Re: Changing Unix <CTRL>M to DOS
you can use the Replace method to change all the <Ctrl>M into vbCrLf
if the file is small enough you can read it into a string, if not, you have to read smaller pieces.
Marco
mstraf at 2007-11-11 17:27:50 >

# 2 Re: Changing Unix <CTRL>M to DOS
thanks for the quick reply Marco. My problem is I'm quite the novice with VB and I'm not finding much documentation on how I would set this up. Do you have any example code that would help in this - or maybe point me to a place I might find it?
kgkidd
kgkidd at 2007-11-11 17:28:49 >

# 3 Re: Changing Unix <CTRL>M to DOS
on which part do you need help? Opening the file, read it, using Replace, or display it? Do you have MSDN installed?
Marco
mstraf at 2007-11-11 17:29:48 >

# 4 Re: Changing Unix <CTRL>M to DOS
No, I'm afraid MSDN is not installed and I'm in such a controlled environment that isn't going to happen. Specifically I'm looking for help on using Replace.
Thanks Marco
kgkidd
kgkidd at 2007-11-11 17:30:53 >

# 5 Re: Changing Unix <CTRL>M to DOS
leaving a programmer without MSDN is suicidal...
at least you have internet access, you can get the help online at www.msdn.com (but itis not the same as hitting F1 on the keyboard!)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vafctreplace.asp
This for example
Replace$("aSssSw","s","Q",,,vbTextCompare)
will return "aQQQQw"
Marco
mstraf at 2007-11-11 17:31:49 >

# 6 Re: Changing Unix <CTRL>M to DOS
Yes, it seems very suicidal here - but that help is exactly what I'm looking for. Thank you very much Marco.
kgkidd at 2007-11-11 17:32:48 >
