-
Metafiles
Hey,
I have the following code
Code:
void main()
{
printf("1st element: %d\n", Metas[0]);
hexe = GetModuleHandle(NULL);
reshandle = FindResource(hexe, MAKEINTRESOURCE(Metas[0]), "Metafile");
if (reshandle == NULL)
printf("Did not find resource.\n");
else
printf("reshandle: %d\n", reshandle);
hglobal = LoadResource(hexe, reshandle);
if (hglobal == NULL)
printf("Did not load resource\n");
else
printf("hglobal: %d\n", hglobal);
//istream* metastream = (istream*) LockResource(hglobal);
char *metastream = (char*) LockResource(hglobal);
if (metastream == NULL)
printf("could not lock resource\n");
system("PAUSE");
}
to my understanding, the LockResource function returns a pointer to the first byte of the resource.
I need to be able to convert the metastream file into istream format.
How would i go about doing that?
Thanks,
-
Re: Metafiles
It's always int main, never void main.
What you need is a stream buffer (a class derived from streambuf) that reads from the memory you provide to it. You might find one via Google or you can write it yourself. It's not hard.