Results 1 to 6 of 6

Thread: Binary Files

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2001
    Location
    UK
    Posts
    271

    Question Binary Files

    hi,

    Ok what I want to do is using an inputbox, enter the path of a file, I need to read it in as binary.
    I want to then read 4 other files this way.

    I will then need to add them to a new file called 'Agent01.bef'

    I know I'll have to add a header to this file, which tells me how long the files are so I can get them out of this file again.

    and then once the file (Agent01.bef) is created I want to be able to break the file apart again into its original four files.

    how do I this?

    Thanks
    §tudz

    Studzworld.com - Portfolio

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Did you check BinaryReader & BinaryWriter Classes !
    VB Code:
    1. 'reading
    2. Dim BINread As New IO.BinaryReader(IO.File.OpenRead(path))
    3. Dim str As String = BINread.ReadString()
    4. .
    5. .
    6. 'writing
    7. Dim BINwrite As New IO.BinaryWriter(IO.File.OpenWrite(path))
    8. BINwrite.WriteLine("A String")
    9. BINwrite.WriteLine(12345)

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    a good example

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2001
    Location
    UK
    Posts
    271
    I did look in MSDN at the binaryreader/writer stuff, but I couldn't make sense of how to do it...


    Thanks
    §tudz

    Studzworld.com - Portfolio

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2001
    Location
    UK
    Posts
    271
    to be honest, that code, doesn't help all it is, is a similar copy of what is in MSDN.

    It writes the value

    A String90

    to a file?

    I need to read in 'FileA' and 'FileB' and then output them into one one file 'FileC'

    as well as attaching a header, which allows me to break them apart, back to their original files later.

    I would also like to know how to do this.

    Pirate your help has been great in the past, but maybe a bit of an explination of how to do these function may help.

    thanks for your help.
    §tudz

    Studzworld.com - Portfolio

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    I haven't a clue about headers .This what I was talking about !I hope it helps !
    Attached Files Attached Files

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