Solved

Append multiple picture files...

Posted on 1998-10-14
5
141 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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 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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

705 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