Results 1 to 5 of 5

Thread: Join 2 files together

  1. #1
    Guest
    I am working on a high powerful (but INCREDIBLY slow) compressor (or is it -er). I've managed to compress a 2MB file down to around 200 Kb. It's really good for compressing single files, but being able to compress multiple files into one file is pretty much the whole point of these archiving programs (like WinZip and WinRar and WinAce).

    My point is, is there any way to put two files together? Opening it up using the Open "C:\Test.txt" For Input As #1 isn't exactly the best way to go because it doesn't open JPEG files properly for some reason.

    I also need to put some characters in between to seperate the files (maybe 16 null characters or something).


    Thanks to anyone who can help.

  2. #2
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Why don't you open the files as binary instead?

    If you want to stick all the files together, you could create an area at the beginning of the file that details where each file starts and ends, so that you know how to split them up afterwards.
    Harry.

    "From one thing, know ten thousand things."

  3. #3
    Guest
    I didn't even know about this binary thing. Stupid me.

    But the thing is, how will I tell if the information is part of the file, or the information about the file?

  4. #4
    Guest
    Is this what you want?

    Code:
    ' #VBIDEUtils#************************************************
    ' * Programmer Name  : Waty Thierry
    ' * Web Site         : http://www.geocities.com/ResearchTriangle/6311/
    ' * E-Mail           : [email protected]
    ' * Date             : 14/06/99
    ' * Time             : 11:54
    ' * Comments         : Join two files together
    ' *
    ' *****************************************
    
    Public Function JoinFiles(Source1 As String, Source2 As String, _
       Dest As String) As Boolean
       
       On Error GoTo errorhandler
       Dim Buffer() As Byte
        
       
    
       Open Source1 For Binary Access Read As #1
       Open Source2 For Binary Access Read As #2
       Open Dest For Binary Access Write As #3
       
       ReDim Buffer(1 To LOF(1))
       Get #1, , Buffer
       Put #3, , Buffer
       
       ReDim Buffer(1 To LOF(2))
       Get #2, , Buffer
       Put #3, , Buffer
       
       Close #1, #2, #3
       JoinFiles = True
    Exit Function
    errorhandler:
        Close #1
        Close #2
        Close #3
    
    End Function

  5. #5
    Guest
    Thanks Matt. It's close to what I want, but I have to read each byte seperately. I'll work on it from here.

    Thanks guys (Harry and Matt).

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