Hi all,
I hope that someone here can tell me the correct way to use char* for strings.
My code is similar to the following:
char* filename = "\0";
char* fileno = "\0";
for (int i=1;i<20;i++)
{
capGrabFrame(hWnd);
strcpy(filename, "C:\\pic");
itoa(i,fileno,10);
filename = strcat(filename,fileno);
filename = strcat(filename,".bmp");
capFileSaveDIB(hWnd, filename);
}
It seems perfectly logical to me, but no matter what I try, I always get a seg fault or some bizarre string as output! Because of the API, I think I have to use char*. Believe me, I'd use a string class if I could!
TIA
Gregor
I hope that someone here can tell me the correct way to use char* for strings.
My code is similar to the following:
char* filename = "\0";
char* fileno = "\0";
for (int i=1;i<20;i++)
{
capGrabFrame(hWnd);
strcpy(filename, "C:\\pic");
itoa(i,fileno,10);
filename = strcat(filename,fileno);
filename = strcat(filename,".bmp");
capFileSaveDIB(hWnd, filename);
}
It seems perfectly logical to me, but no matter what I try, I always get a seg fault or some bizarre string as output! Because of the API, I think I have to use char*. Believe me, I'd use a string class if I could!
TIA
Gregor