Solved

Append multiple picture files...

Posted on 1998-10-14
5
137 Views
Last Modified: 2010-04-30
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
0
Comment
Question by:jersam
  • 3
5 Comments
 
LVL 14

Expert Comment

by:waty
ID: 1439867
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.
0
 

Author Comment

by:jersam
ID: 1439868
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
0
 
LVL 2

Accepted Solution

by:
AllenC_Jr earned 50 total points
ID: 1439869
'. |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
0
 
LVL 2

Expert Comment

by:AllenC_Jr
ID: 1439870
'. |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
0
 
LVL 2

Expert Comment

by:AllenC_Jr
ID: 1439871
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

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now