embedding a text file into a dll

  • Thread starter Thread starter wheels619
  • Start date Start date
W

wheels619

Hi,
I would like to store the contents of a file into a string variable and
stored in a C++ DLL.
In the end, the finished product will just be the DLL and the user will
not see the file itself. Another program can then access this variable
by an extern.

Any ideas how to do this?

Thanks
 
Hello,

Use it as a resource file, but it has a max length of 64k (I Dont know
the file size)
Or put the file at the end of the DLL and read it by hand! (fopen fseek
fwrite fread)

[]s
 
Use it as a resource file, but it has a max length of 64k (I Dont know
the file size)
This sounds like a good solution; how can you get access to the
resource from the C++ code?
 
This sounds like a good solution; how can you get access to the
resource from the C++ code?

Use FindResource to get a handle for it, then LoadResource to load it to
the memory, and finally LockResource to get a void* pointer to it.

Tom
 
Tamas said:
Use FindResource to get a handle for it, then LoadResource to load it to
the memory, and finally LockResource to get a void* pointer to it.

And SizeofResource to get the size of the resource, in bytes.

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top