Results 1 to 4 of 4

Thread: Split file in multiple files

  1. #1

    Thread Starter
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    I want to know how I can make a prog that can split files (mp3 for example) into small parts,
    wich can than be put on floppy for example, and later restored with another program (or the same).

    TIA,
    (:. Jop .:)
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Of course you can. But i would prefer zipping them.

    Just open you file in binary and make a loop fill a buffer with next amount of characters in a string with Get statement. Then open another file in binary ie: thefirstfilename & index. And put the string into it, and then make make the loop go while raising index until you've got eof.

    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

    Thread Starter
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Erm... I know I'm stupid, but what's the index? an integer?

    Like

    [code]
    Do
    Open File For Binary Acces Write As fn '(is this right?)
    Get fn, NR of LINES, INTOstring '(and this, is this right?)
    Close fn

    Open FILE2 For Binary ...
    Put ...
    Close ...

    Open FILE3 For ...
    Put ...
    Close ...

    But where do I have to put that Index thingy?

    Thanks Kedaman, you're a real help for me and lots of others here I think!

    Jop
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  4. #4
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    The index he is talking about is the loop variable which is being used in the get statement as the file postion pointer.

    Look up get and put in msdn under the file method binary and you'll see.

    Get #1, Index, Var

    It's worth buffering. eg don't loop and get one byte at a time because it'll slow it down. If you're after 1.4mb then grab 1.4 mb at a time (I wouldn't recommend much more than that though) (by Dim'ing the array to that size. the get and put will only use as much data as the array size.

    Or, if memory is not an issue, grab the whole file and put it into pieces.

    I hope this makes sense (it's early here)
    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

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