Link to home
Start Free TrialLog in
Avatar of jersam
jersam

asked on

Append multiple picture files...

Having problems appending files!
How do I Read in two small picture files into seperate buffers, without reading past end of files, and then write them out appended in another file? VB4.0
Avatar of waty
waty
Flag of Belgium image

Picture files are not traditionnal files, what do you want exactly do?

You can't store 2 pictures in one picture (the first followed by the second ).

If you want to overlap them, it is possible.
Avatar of jersam
jersam

ASKER

OK... I have this Program called visual places...
I have pretty much figured out the file format for the gesture files.
The format is as follows:
     A header of 50 bytes or so
     A 20 by 20 Gif file (Icon for the Program)
     A Gif file with multiple pictures( Animation)
     A Wave File... Self explanitory

My Problem is I am trying to write a program to Append a gif file that could be of variable length after the 20 by 20 Gif
file. I can then enter the header at the top with my hex editor and have a File that hopefully will work in my Program.

I Have Been able to read the file in its entirety except for the null bytes..
For Example...

File 1 (GIF file)first 32 bytes:

                   Hex                              Asci      
47 49 46 38 39 61 14 00 14 00 b3 00 00 00 00 00  GIF89a..........
63 00 00 9c 00 31 ce 00 31 ff 00 00 ff ff ff ff  c....l..l.......
 
File 2 (Output File) in hex form:

                   Hex                               Asci  
47 49 46 38 39 61 14 14 b3 63 9c 31 ce 31 ce 31  GIF89a...c.l.l..
ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff  ................

See my problem ?
When I read it in I get The file without the null Bytes
I am not reading the file in properly...
I have tested to find this out.

So I guess the question is really how to I read it in properly...
I can Append the files fine... If I can Read them in right...

If U understand I would can understand my babling...
Please help! More Points may be available
ASKER CERTIFIED SOLUTION
Avatar of AllenC_Jr
AllenC_Jr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
'. |You could Load the File Binarily, Like this.

Private Type BinFile
FileBytes() as Byte
End Type
Private Sub OpenFile(Filename as String) as BinFile
Dim FF as Long, FileBytes as BinFile
FF = FreeFile
Redim FileBytes.FileBytes(1 to FileLen(FileName))
Open Filename for Binary Lock Read As #FF
Get #1, 1, FileBytes.FileBytes()
Close #FF
OpenFile = FileBytes
End Sub

Private Sub Form_Load()
Dim MFil as BinFile
MFil = OpenFile("C:\New.txt")
Msgbox CHR(MFil.FileBytes(1)) 'In order to read each byte properly you need to change it to Ascii format, it is currently in A byte format(ASC).
End Sub

'. |Hope this Helps
OOps sorry about that i meant to say


Oops change the

Get #1, 1, FileBytes.FileBytes()

To

Get #FF, 1, FileBytes.FileBytes()

I noticed that AFTER i submitted it