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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing to Text files 1

Status
Not open for further replies.

CptTom

Programmer
Jul 16, 2001
117
US
Why does VB6 add a single quote mark to beginning and end of each of the text files I am writing to and how can I prevent it?

Larry

Sample code:

Do While Not EOF(1) ' Loop until end of file.
Line Input #1, strLine ' Read line into variable.
strType = LTrim$(strLine)
strType = Left$(strType, 6)
strUIC = strType
strRSC1 = strType
Debug.Print "Line " & intLine & " is:" & strLine
Debug.Print "Type is:" & Left$(strType, 2)
Select Case Left$(strType, 1)
Case "("
Debug.Print "UESSR Code is :" & strRSC1
Debug.Print "strRSC is :" & strRSC
If strRSC1 <> strRSC Then
intRSCCount = intRSCCount + 1
Debug.Print &quot;Writing &quot; & 2 & &quot; &quot; & intRSCCount
Write #2, LTrim$(strLine)
Write #3, LTrim$(strLine)
Write #4, LTrim$(strLine)
strRSC = strRSC1
End If
Case &quot;W&quot;
intUICCount = intUICCount + 1
Debug.Print &quot;Writing &quot; & 3 & &quot; &quot; & intUICCount
Write #3, LTrim$(strLine)
intLineInput = Mid$(strLine, 48, 2)
Debug.Print &quot;LineInputs is :&quot; & intLineInput
If intLineInput < 1 Then
Write #4, LTrim$(strLine)
intBadCount = intBadCount + 1
End If

End Select
intLine = intLine + 1
txtCounter.Text = intLine & &quot; of &quot; & intLineCounter & &quot; to Process&quot;
Loop
 
Larry,
Use the Print #FN, .... rather than write. Should solve the problem. Dan Grogan
dan@siqual.com

&quot;Absit prudentia nil rei publicae profitur.&quot;
Without common sense you ain't gonna have nothing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top