C语言字符转换为数字的问题
ha_y 2003-08-21 01:10:29 #include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
using namespace std;
main()
{
char *pLogPath;
int iFileLoop = 1;
while ( iFileLoop < 10 )
{
char cFileLoop = (char) iFileLoop;
strcat( pLogPath, "(" );
strcat( pLogPath, cFileLoop );
strcat( pLogPath, ")" );
printf("%s", pLogPath);
}
}
出错cFileLoop 必须是const char才能用strcat(),但是怎样才能达到同样的效果呢?