Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Append multiple picture files...

Posted on 1998-10-14
5
Medium Priority
?
143 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 200 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

609 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