Results 1 to 2 of 2

Thread: How can I open a file and....

  1. #1
    Guest

    Post

    ....put in memory as a string or an array of

    bytes) everything from the file but the

    VbCRLF's?

    thank you

    ------------------

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    Code:
    Private Sub cmdLoad_Click()
        Dim iFile As Integer
        Dim lChunk As Long
        Dim lFileLen As Long
        Dim sChunk As String
        Dim sData As String
    
        iFile = FreeFile
        Open "C:\TheFile.txt" For Binary Access Read As iFile
        lFileLen = LOF(iFile)
        lChunk = 64000
        While Loc(iFile) < lFileLen
            If lChunk + Loc(iFile) > lFileLen Then lChunk = lFileLen - Loc(iFile)
            sChunk = Space(lChunk)
            Get #iFile, , sChunk
            sData = sData & sChunk
        Wend
        sData = Replace(sData, vbCrLf, "")
        Close iFile
    End Sub
    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]


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