Results 1 to 8 of 8

Thread: File packer producing strange error [Resolved]

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2001
    Posts
    421

    File packer producing strange error [Resolved]

    The file packer I've made is doing something weird. When it extracts the packed files, it puts characters in the beginning of a file. For example, if a text file called Dog.txt has been packed like this:

    Code:
    Hello, I am a dog.
    What are you?
    It will extract like this:

    Code:
     % Hello, I am a dog.
    What are you?
    It does this on all file types, not just text files. Anyone know what could be going wrong?
    Last edited by Oafo; Oct 15th, 2002 at 12:38 AM.
    [vbcode]
    ' comment
    Rem remark
    [/vbcode]

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2001
    Posts
    421
    Here's the project file and what not.
    Attached Files Attached Files
    [vbcode]
    ' comment
    Rem remark
    [/vbcode]

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2001
    Posts
    421
    Don't tell me that nobody else has had this problem..
    [vbcode]
    ' comment
    Rem remark
    [/vbcode]

  4. #4
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    You should be using a byte array to get and retrieve the data instead of a string....

    you put it in as a string, so everytime a vbcrlf is encountered, its storing it as 4 bytes instead of 2...
    Last edited by nemaroller; Oct 14th, 2002 at 10:20 PM.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2001
    Posts
    421
    I know, I know... but that doesn't account for the characters appearing in the beginning of every unpacked file, does it?
    [vbcode]
    ' comment
    Rem remark
    [/vbcode]

  6. #6
    Frenzied Member Zaei's Avatar
    Join Date
    Jul 2002
    Location
    My own little world...
    Posts
    1,710
    Strings contain a header (which VB hides from you). You might be printing thsi heade to the file unknowningly. If you can, re-write your function to write the string byte by byte.

    Note, I didint look at your code at all.

    Z.

  7. #7
    I wonder how many charact
    Join Date
    Feb 2001
    Location
    Savage, MN, USA
    Posts
    3,704
    Just use a byte array...

    declare a blank array... Dim myBytes() As Byte
    Open the file...

    Then Redim myByte(LoF(1))
    Then Get #1,,myBytes
    Last edited by nemaroller; Oct 14th, 2002 at 11:53 PM.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2001
    Posts
    421

    File packer producing strange error [Resolved]

    I got it finished without using a Byte array. The problem was because the array was declared as a Variant, so I removed the Split code completely and just parsed the data into a String array -- which turned out to be a lot faster anyway. Thanks for the help guys.
    Last edited by Oafo; Oct 15th, 2002 at 12:38 AM.
    [vbcode]
    ' comment
    Rem remark
    [/vbcode]

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