Results 1 to 5 of 5

Thread: Cropping files, again

  1. #1

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Unhappy

    Well since no one did found out the answer, last time i asked this, how do you shorten a file without having to rewrite it again?

    In example a 50M file would take about 15 seconds to remove the last 1 byte, not too impressive. I'm sure it can be done, maybe not in vb but in C++ or something.

    Thanks.

    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.

  2. #2
    Lively Member
    Join Date
    Apr 2000
    Posts
    110

    Question Why?

    Kedaman why can't you overwrite the file? just wondering, and what are you trying to do????

    Later(z)

    REM
    "Innovate, don't immitate."

  3. #3

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Well, actually it's just mp3's that are from 3-5M but it costs a second and on slower machines up to 10 sec. I've posted this earlier but nobody did know. Now I hope someone knows, and i know it must be some way of doing it
    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.

  4. #4
    New Member
    Join Date
    Sep 2002
    Location
    PA,USA
    Posts
    2
    I'm trying to find the same answer, it seems it might be possible if you open it and work it via API calls, then there is a function:
    Private Declare Function SetEndOfFile Lib "kernel32" (ByVal hFile As Long) As Long
    That can do it, the trick is converting a Filenumber to a file handle

  5. #5
    Fanatic Member
    Join Date
    Jun 2001
    Posts
    521
    FindFirstFile(...) will give you a filehandle...
    ReadFile(...) will allow you to go to the position where you want to set the EndofFile.
    SetEndofFile(...) will set the end of the file to be that position that you read to (AFAIK).
    Rember to use FindClose(...) when done w/the handle.

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