Solved

Streams

Posted on 1998-06-16
7
135 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
Independent Software Vendors: 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!

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

685 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