[quote=gomesrod]Tente usar a classe stringstream para montar a String composta.
[code]
// No início do arquivo, na parte dos includes…
#include
///////////////////////////////////
int cont = 0;
while( cont <= 100){
cont++;
std::ostringstream caminho;
caminho << "C:\\Temp\\Snapshot_" << cont << ".bmp";
SaveBitmap(caminho.str().c_str());
Sleep(1000);
}
[/code][/quote]
Valeu! mesmo gomesrod.
vou testar aqui muito obrigado.
Att Javax
Amigo fiz o teste porem não deu certo
o código que você me envio esta passando uma string e o meu método SaveBitmap
recebe char conforme abaixo
bool SaveBitmap(char *szFile)
{
BITMAPFILEHEADER hdr;
BITMAPINFOHEADER bmi;
if (!pImgBuf)
return FALSE;
FILE *file = fopen(szFile, "wb");
if (file==NULL)
return FALSE;
int imgPitch=((3*imgW)+3)&~3; // round up to multiple of 4
bmi.biSize=sizeof(BITMAPINFOHEADER);
bmi.biWidth=imgW;
bmi.biHeight=imgH;
bmi.biPlanes=1;
bmi.biBitCount=24;
bmi.biCompression=BI_RGB;
bmi.biSizeImage=imgPitch*imgH;
bmi.biXPelsPerMeter=0;
bmi.biYPelsPerMeter=0;
bmi.biClrUsed=0;
bmi.biClrImportant=0;
// Fill in the fields of the file header
hdr.bfType = ((WORD) ('M' << 8) | 'B'); // is always "BM"
hdr.bfSize = bmi.biSize + bmi.biSizeImage + sizeof( hdr );
hdr.bfReserved1 = 0;
hdr.bfReserved2 = 0;
hdr.bfOffBits = (DWORD) (sizeof(hdr) + bmi.biSize);
// Write the file header
fwrite(&hdr, sizeof(hdr), 1, file);
// Write the DIB header
fwrite(&bmi, bmi.biSize, 1, file);
// Write image data
int offset=BlackLevel;
float scale=0.0f;
if (WhiteLevel!=BlackLevel)
scale=255.0f/(WhiteLevel-BlackLevel);
char *pix = (char*)malloc(imgPitch);
for (int y=0; y<imgH; y++)
{
unsigned short *pSrc=pImgBuf+((imgH-y-1)*imgW);
char *pDest=pix;
for (int x=0; x<imgW; x++)
{
// single input channel (greyscale)
int v=*pSrc++;
// adjust according to black/white levels
v=(int)((v-offset)*scale);
if (v<0) v=0;
else if (v>255) v=255;
// three output channels (B,G,R)
*pDest++=v;
*pDest++=v;
*pDest++=v;
}
// pad to multiple of 4 bytes
//for (int x*=3; x<imgPitch; x++)
//for (int x = 1; x < imgPitch; x++)
// *pDest++=0;
fwrite(pix, imgPitch, 1, file);
}
fclose(file);
free(pix);
return TRUE;
}
porem mesmo assim muito obrigado pela atenção.
caso você souber de algo que possa me ajudar , ou poder me dar uma dica de como posso resolver
Att JavaX
Bom galera achei a solução segue abaixo
// concatenar Char + Inteiro em visual C++ 2005
char result[32] = "C:\\Temp\\Snapshot_";
char dummy[1024]; /* or something big enough */
char Tipo[] = ".bmp";
sprintf(dummy, "%s%d", result, cont);
printf("%s\n", dummy); /* should output abcdefg12 */
SaveBitmap(strcat(dummy, Tipo));