Results 1 to 6 of 6

Thread: Removing characters from end of file

  1. #1

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I'm opening files in Binary and have a problem here: How do I remove characters from the end of the file, In other word, reduce the file length. Currently I'm deleting the whole file and replacing it with the left content. Is there any other ways of doing this?

    Also, how do I get a memory pointer using StringFromPointer or any other API?

    Any Help will be appreciated.

  2. #2
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Hello Mr. Kedaman!

    I am not sure what you are doing, but here is my input. Why don't you use the replace function and replace what you are looking for to null?


    Chemically Formulated As:
    Dr. Nitro

  3. #3

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I can't find any replace functions in my VB5, I'm not sure if you did understand what I'm doing too. Using Put I can write to files, but not remove characters that I've writed. I'm changing contents to mp3'z that can be up to 6M so I don't like the idea of deleting the file each time I change it (and the file gets smaller)

  4. #4

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    O, Cool, I have your signature now.

  5. #5
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Kedaman!

    Sorry, I did not know that you are using VB5. REPLACE function is only in VB6.

    Anyway, why don't you use INSTR to find the EOF mark. I can't remember off the top of my head, but there is a property regarding EOF.

    Actually, if you send me your email address, I can send you this sample of a rich text box. You can pull your file in and delete whatever characters you want and save it again.


    Chemically Formulated As:
    Dr. Nitro

  6. #6

    Thread Starter
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Oh yeah, EOF returns true when im exceeding the last record in a random/last byte in a binary file. But how do I move it. I can take a look at your sample, but I really don't want to use any Richtextboxes in my project. The email should be shown when you mouseover the mail link here.

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