0

Hello,

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:

resource.rc

LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDR_0_1            0              "..\\..\\..\\..\\..\\Desktop\\test.txt"

resource.h

#define IDR_0_1                                 119

main.cpp

HRSRC hRes = FindResource(0, MAKEINTRESOURCE(IDR_0_1), "0");
HGLOBAL hData = LoadResource(0, hRes);
LPVOID data = LockResource(hData);
4
Contributors
9
Replies
13
Views
5 Years
Discussion Span
Last Post by Moschops
0

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?

0

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

0

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.

0

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

0

bump?

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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.