Click to See Complete Forum and Search --> : Carriage Returns/New Lines in file


Mark Wold
August 10th, 2000, 11:38 AM
I am trying to write a file that will be read on a UNIX box. The following code always writes a CR/NL combo at the end of each line:

dim i as integer
i = freefile
open "C:\TEXT.TXT" for output as i
print #i, "Hello there, World"
close #i

I have tried the following code but end up getting byte counts at the beginning of the line:

dim i as integer
i = freefile
Open "C:\text.txt" For Binary Access Write As #i
Put #i, , "Hello there, World" & Chr(10)
Close #i


Can somebody please explain to me if this is possible or not?

Thanks,
Mark
mark@faxinnovaitons.com

John G Duffy
August 10th, 2000, 07:32 PM
If what you are trying to do is eliminate the CRLF after each line replacing it with a NL try thie

print #i, "Hello there, World"; vblf;


Note the ; (semi-Colon) after the vbLF. This tells VB you are not finished with the current line and do not append a crlf after it. DO this for the entire file alwaays ending your print command with the ;

John G