Solved

Streams

Posted on 1998-06-16
7
133 Views
Last Modified: 2010-04-04
I know the TSaveToStream etc. but i cant get the stuff working as i want..

in need a Sample of where you like select files and Add the to a Data File, and how to get in contact with them,
like putting 10 exe files in a dat file, and be able to run the apps..
0
Comment
Question by:brainware
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 1

Expert Comment

by:michaue
ID: 1353325
Let me see if I understand you correctly.

You want

1.  the user to be able to select files and then your program must write the locations of the files into a data file
2.  the program to read this data file at a later stage and display it as a pick list to the user.
3.  the user to pick one of the listed files and then run it from within your program

???


0
 
LVL 2

Author Comment

by:brainware
ID: 1353326
I want to copy the files into a DATA file, like a WAD file..
and be able to use the files in hmm WAD file,
like this:  make a WAD!!! file with 10 jpeg or bmp pics, and be able to get info from the
wad file of whats in it, and be able to view the pics..

dont have to be pics... but somthing not only text.

hope u can do it.. now im being nice.. +pts
0
 
LVL 1

Expert Comment

by:michaue
ID: 1353327
Nope, you've lost me ...

Hope you find an answer ... you should, this is a pretty good site

Have Fun

Elfrieda :)
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 1

Expert Comment

by:Socrates050697
ID: 1353328
I thik this is what you need :-

1. Create a new TFilestream

2. Add a header to it showing what files are going to be stored in the DAT file. (I've done this before by creating a new component - THeader, which has some string properties. Being a component you can just stream it out into the TFilestream)

3. Load the Bitmaps (or whatever) using a TMemorystream object.
4. Stream the TMemorystream to the TFilestream
5. Repeat steps 3 and 4 for each file.

To then extract the files, you have to read the header and then read each of the files and save the one you want as a file on its own. It can then be used as normal.


Socrates.
0
 
LVL 5

Accepted Solution

by:
ronit051397 earned 190 total points
ID: 1353329
This is something I found somewhere, Hope this helps:

14. Appending Files

Q:
Does anyone have a procedure/advice/whatever for adding several files
onto one file, then separating them back into the original files /w
filenames, properties, and everything? I was thinking of using the
Append() procedure, but that's for text files, and I'm working with
binary files (compressed, encrypted, what have you).

A:
What I would do is this:

First I create a TFileStream.

Then Write to it a blank but a fixed length header block .

This header block can contain anything you want to keep in
there; such as starting pos of each 'file', their lenths,
file names, copyright info etc.

Initially you can just write a blank header block to act
as place holder (you'll fill it up later)

Then create as many TMemoryStream as you have files/data/whatever.

Then using MyMemoryStream.SaveToStream(MyFileStream) write every
one of those MemoryStreams into the FileStream. Making a note of
MyFileStream.Posotion and MyMemoryStream.Size.

Havin filled your MyFileStream with data, you can now set

FileStream,Position := 0
and fill up the header block you had rserved in the first step.

Retrieving each data block is simply a reverse of this.

[kanca@ibm.net]
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1353330
0
 
LVL 2

Author Comment

by:brainware
ID: 1353331
k.. ill just have to get the rest working from there..

0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

773 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