Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 Remove final CR LF character from a text file 1

Status
Not open for further replies.

mcs1000

Programmer
Jul 3, 2007
26
0
0
GB
I need to remove the last CR/LF character from a text file.

I have managed to remove the rest of the CR/LF chars using seek.

Is there any way to print a line to a file without the CR/LF character or to remove the last character in a file.
 
Use a semicolon at the end of your Print line.

Code:
Print #x, variablestring;

Lee
 
Damn,

Thanks for your answer but I already spent half the day figuring this out.

I found out because I'm writing text with no control characters I can just write to the file as a binary file.

Thanks again for your help
 
Another option would be to use the 'Left' statement

Print #x, Left(variablestring, len(variablestring) - Len(vbCrLf))

Chris
 
Again this proves the saying that there are many ways to accomplish the same task...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top