>Hi, when i try to convert int to char with _itoa, dont work in my machine, exist a different way for do this job?
>
>this is my code:
>
>char szFile[12] = "";
>char buffer[33];
>int i = 0;
>_itoa(i,buffer,10);
>lstrcat( szFile, "portlog");
>lstrcat( szFile, buffer);
>lstrcat( szFile, ".dbf");
>//lstrcpy(szFile,szFile);
>AfxMessageBox(szFile);
>
>thanks in advance
>
>Regards
>
>Francisco Morosini
wsprintf( szFile, "portlog%d.dbf", i ) ;
Also note that szFile is not big enough to accept the final string, remember that there is a terminating 0, so you need a minimum size of 13 chars.
if you have UNICODE defined, then you need to use WCHAR for the correct type, & use _itow.
alternatively use TCHAR & _itot, which set the correct types/functions according to whether UNICODE is set or not.
Len Speed