Results 1 to 2 of 2

Thread: Metafiles

  1. #1

    Thread Starter
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950

    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,
    Don't anthropomorphize computers -- they hate it

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    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.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width