I've added TXT file to my resource, but now I need to know how to access data in it?

can I use iostream to read data?

I have this:


IDR_0_1            0              "..\\..\\..\\..\\..\\Desktop\\test.txt"


#define IDR_0_1                                 119


HRSRC hRes = FindResource(0, MAKEINTRESOURCE(IDR_0_1), "0");
HGLOBAL hData = LoadResource(0, hRes);
LPVOID data = LockResource(hData);

The line

IDR_0_1            0              "..\\..\\..\\..\\..\\Desktop\\test.txt"

tells me that you have a resource table and that it contains one string entry (IDR_0_1), whose value is ..\\..\\..\\..\\..\\Desktop\\test.txt. It doesn't seem like the actual text file test.txt has been added as a resource. Or am I wrong?

ya, u are wrong, I've added user resource with ResEdit, that "..\\..\\..\\..\\..\\Desktop\\test.txt" is the path to the file

Alrighty then. In that case, you will need to first access the file itself by reading its path from the resource table. You should be able to then read in the file with iostream.

I just noticed an mistake in my post, it should me "fstream" instead of "iostream", sorry :P


Do not be rude and bump threads. If someone can help they will when they get to it.
And this bump is exceptionally rude because you were asked questions and rather than answer them you just said bump? I know I would refuse to help with that attitude.

This article has been dead for over six months. Start a new discussion instead.