Possible Duplicate:
C++ convert int and string to char*
The function I use looks like this:
int cvSaveImage(const char* filename,const CvArr* image);
This function expects a const char*
as first parameter. For example:
cvSaveImage("ImageName",img)
would be right.
However, I would like to put instead of 'Name' in "ImageName", an int
variable value.
I've tried something like this, but doesn't work at all, it crashes:
int num = 10;
char buffer[1024];
sprintf(buffer,"Image%d",num);
cvSaveImage((const char *)buffer,img);
Any ideas?