sprintf Question

I am new with this sprintf function and need some help if possible.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//LAST_FILLER_NUMBER, FIRST_FILLER_NUMBER, FILLER_IMAGE_EXT  are all globals
// This function is being passed a string to a directory
//load the filler images from the given folder into a linked list of fillerImage classes.
bool loadFillerImagesFromFolder(string folder)
{
	char buffer[900];
	fillerNode *location = new fillerNode;
	fillerNode *pre = head ;
	fillerNode * next = NULL;

	for ( int i = FIRST_FILLER_NUMBER; i < LAST_FILLER_NUMBER; i++ ) // loop through all 900 images
	{
		filler.setTimesUsed(i);
		location->data = sprintf(buffer, "%i %s \n", filler.getTimesUsed() , FILLER_IMAGE_EXT );
	//  I get and error cannot convert from "int" to fillerImage*" on line 14
        }
        .....
        .....
	return true;
}
// here is the fillerNode.h file
struct fillerNode
{
	fillerImage *data;
	fillerNode *pre;
	fillerNode * next;
};

I will use *pre and *next to fill the node with the images after I get the line 14 error fixed.

Thanks
Last edited on
Anyone?
sprintf functions returns and int, and what it is doing is assigning value of filler.getTimesUsed() , FILLER_IMAGE_EXT into buffer in form of string.

Probably you want to assign location->data = buffer



Gorav
http://www.kgsepg.com
Thanks for your reply. I will see what I can do.
Topic archived. No new replies allowed.