Solved

Streams

Posted on 1998-06-16
7
137 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
[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
  • 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

739 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