CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 1999
    Location
    London, England
    Posts
    9

    Writing text files

    I am having a problem writing to a text file without having quotes round my strings. The help files talk about print# statement but it doesn't seem to work. What am I doing wrong.


  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Writing text files

    try this

    Open "c:\yourfile.txt" for Output as #1
    print #1, "this is a string"
    print #1, """this is a string""" ' will have quotes

    Close #1





  3. #3
    Join Date
    Feb 2000
    Location
    Indiana
    Posts
    308

    Re: Writing text files

    If you want quotes around your strings, you can use write.

    Dim sString as string
    sString = "This is my text"
    Write #1, sString



    would put "This is my text" (in quotes) in your file. Using the Write statement put's quotes around strings, #'s around dates, and signifies boolean data by #TRUE# or #FALSE#. The Write statement also comma-delimits your data.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured