Writing to a file

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Writing to a file

  1. #1
    Anthony Verna Guest

    Writing to a file

    I know people probably call me "The Incompetant One."

    Anyway, I have a weird error. When I write to a file with my function, all
    the lines are embedded in quotes. That makes no sense to me. What could
    I be doing wrong?


    Private Sub ReadProjectFile(ByVal strFileName As String, ByRef Version As
    Double, _
    Optional ByVal strSectionName As String, Optional ByVal strGUID As String)

    Dim strText As String, strTemp As String
    Static strVer As String
    Dim i As Long, j As Long
    ' i is the file number to read, j is file number to write

    j = FreeFile
    Open (strFileName & "temp") For Output Access Write As #j

    i = FreeFile
    Open strFileName For Input Access Read As #i

    Do Until EOF(i)

    'read the file line by line
    Line Input #i, strText
    If Mid$(strText, 1, Len("Majorver")) = "Majorver" Then 'version
    strVer = Mid$(strText, Len("majorver=")) & "."
    ElseIf Mid$(strText, 1, Len("Minorver")) = "Minorver" Then
    strVer = strVer & Mid$(strText, Len("minorver="))
    Version = CDbl(strVer)
    ElseIf Mid$(strText, 1, Len("Reference")) = "Reference" Then
    'deal with that shortly
    ElseIf Mid$(strText, 1, Len("Path32")) = "Path32" Then
    strText = "Path32=""..\..\bin"""
    End If

    Write #j, strText

    'clear all our memory
    Close #i
    Close #j

    End Sub

  2. #2
    Randy Birch Guest

    Re: Writing to a file

    Change Write to Print.

    Randy Birch, MVP Visual Basic


    Please correspond only using the newsgroups so all can benefit.

  3. #3
    Kathleen Dollard-Joeris Guest

    Re: Writing to a file


    > I know people probably call me "The Incompetant One."

    Yes, everyday at dinner I look at my hubby and say "You know, Anthony is the
    Incompetent One" NOT.

    Look into the differences between Write and Print #. Write uses quotes,
    Print does not.

    Reply in the newsgroup so everyone can benefit

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center