Results 1 to 5 of 5

Thread: Binary file copying...

  1. #1
    Guest
    Okay, my problem is that I make a new header for a file, reading info from old one. But after the header, I should copy many megabytes of data. So what do you suggest?

    Just asking this ready for future use, I know I will need this info a lot, atleast for a while.

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Open both files syncronous, create the new header (Put the header data, (the location will move automatically to the huge data section) Use Get at the position of the old file huge data section (header legnth + 1, i guess) And Get the huge data from old file into a byte array, then put it in the new file and close both.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Guest

    Unhappy Limit

    I've Visual Basic 4 and it seems to have size limit with arrays. I've thought that can I do straight copy or is it have to copy data first into array and then in to the other file?

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    There's a statement for copying file called Filecopy, but i'm sure youre not looking for that, No need to worry about limits, the byte array will be resized automatically before Getting the data. Here's how you do:
    Code:
    Dim a() as byte
    Open Target for Binary as 1
    Open Source for Binary as 2
        Put#1,,HeaderUDT ' or a set of variables
        Get#2,len(HEaderUDT)+1,a
        Put#1,,a
        Erase a
    Close 1,2
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Guest

    Smile Got it

    Okay, I got it work with a couple of changes. Thanks for your help

    Needed to add ReDim A (sizeofdatatobereaded)

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