Results 1 to 8 of 8

Thread: [RESOLVED] Random Access Reading of a Non-Standard Text file

Threaded View

  1. #4
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: Random Access Reading of a Non-Standard Text file

    Are you saying that the file looks like:
    Header - 63 Bytes - required always this size
    Detail - unknown amount of bytes
    Trailer - 395 bytes - required always this size

    If yes

    Code:
            Dim b(1023) As Byte
            Dim fs As New FileStream("c:\foo.txt", FileMode.OpenOrCreate)
            Dim trlr As Long = fs.Length - 395
            fs.Seek(0, SeekOrigin.Begin)
            fs.Read(b, 0, 63)
            fs.Seek(trlr, SeekOrigin.Begin)
            fs.Read(b, 0, 395)
            fs.Close()
    Last edited by dbasnett; Jan 12th, 2010 at 06:34 PM.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

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