[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1605
  • Last Modified:

Write in a text file without vbCrLf vb6

Hello!
   I need to write in a text file in Visual Basic 6 some text lines but without the vbCrLf automatically inserted at the end of the line. If i use the following code:
   
   Open App.Path & "\TextFile.txt" For Output As #1
        Print #1, "Some text"
    Close #1

  this automatically inserts me an vbCrLf (Enter key) at the end of every line. I need to be able to choose if i want to insert Chr(13) or Chr(10) or both in a construction like this:
        Print #1, "Some text" & Chr(13)

    How can i do this?

 Thank you!
0
Cristi_E
Asked:
Cristi_E
  • 2
  • 2
1 Solution
 
Chris BottomleyCommented:
Hello Cristi_E,

I think write supports this but afaik appends quote marks to strings - don't know if this is a problem of itself for you?

Regards,
Chris
0
 
Cristi_EAuthor Commented:
I dont really understand this part: "but afaik appends quote marks to strings ". Please can you be a little more explicit?
    Thank you!
0
 
Chris BottomleyCommented:
afaik - as far as I know

Print #1, "Some text"
results in:
Some Text
with the CR LF being written to stream #1

Write #1, "Some text"
results in:
"Some Text"
 being written to stream #1 ... but no CR LF

Chris

0
 
GrahamSkanRetiredCommented:
Put a semi-colon after the text.
Dim f As Integer
f = FreeFile
Open "C:\NoVbCr.txt" For Output As #f
    Print #f, "Text1" & vbCr;
    Print #f, "Text2" & vbCr;
Close #f

Open in new window

0
 
Cristi_EAuthor Commented:
Thank you verry much!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now