Extracting a user defined file from a resource file

I have compiled a few Text-Based files into a resource file and I would like to be able to save them to file, before executing another windows app to read them and produce the required report. How can I save them to disk ...
taskforceAsked:
Who is Participating?
 
williams2Commented:
Hmm.. Dear TaskForce, you are not good at asking questions. Do you need to save the file from within your application, then the easiest way to do it is like:

var
  SL: TStringList;
Begin
  SL:= TStringList.Create;
  //.. Add some strings ...
  SL.SaveToFile(Filename.TXT);
  SL.free;
End;

or do you want to extract the text from your ressource file? in that case you should use TRessourceStream to first load the .exe file with the .LoadFromFile method, and then identify the ressource type you are looking for.

/Williams
0
 
ZifNabCommented:
By code or manually?

Use TFileStream, or AssignFile, ...

Zif.
0
 
taskforceAuthor Commented:
The dilema : I have text based files that I want to use at some point. I have compiled these into my EXE file as a resource. I now need to know how to programatically extract these before I can use them. i.e. SaveToFile('TextFile.Txt')
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.