Solved

How to add a independent file into a App file by VC++?

Posted on 2000-04-02
4
200 Views
Last Modified: 2010-04-02
How to add a independent file into a App file by VC++?
And the independent file will be copied or extracted from the App, when  necessary. I need a full source VC++ examles. Thanks.
0
Comment
Question by:xiaoma
  • 2
4 Comments
 
LVL 1

Expert Comment

by:ntdragon
ID: 2677454
i don't understand what you exectlly want so explaine it

i won't write your prog for you i"ll just help you

if you want to work with files try the fstream class
0
 
LVL 22

Accepted Solution

by:
nietod earned 100 total points
ID: 2677481
You can include the file your program's resources as a binary (user-defined) resource.  For example, in the .RC file place a line like

DataName DataType C:\somefile.txt

where DataName is the name (or number) you want to use to identify the resource and DataType is the name (or number) of the data type you want to clasify the resource as.

Then in your program you can use FindResource() to find the resournce, use LoadResource to load it, use GlobalLock() to get a pointer to it, then write the file information to a file (using an fstream object or using the windows WriteFile() API)

Let me know if you have any questions.
0
 

Author Comment

by:xiaoma
ID: 2695731
And How to Compress the Resource?
0
 
LVL 22

Expert Comment

by:nietod
ID: 2695934
You can compress the data before adding it to the reasource file and then uncompress it after you load it to memory.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

856 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