首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

警告 assignment makes integer from pointer without a cast是咋回事

2012-03-20 
警告 assignment makes integer from pointer without a cast是怎么回事写了一个函数void get_time(long*

警告 assignment makes integer from pointer without a cast是怎么回事
写了一个函数
void get_time(long* ptime)
{
char buff[4096+1];
int len , i ;
char* pstr;
FILE* fp;
fp=NULL;
fp=fopen("/proc/stat","r");
if(fp !=NULL)
{
len = fread(buff,sizeof(char),sizeof(buff)-1,fp);
fclose(fp);
}else
{
fclose(fp);

buff[len] ="\0";
pstr=sko_token(buff);
for(i = 0 ; i < PNUM ; i++)
{
ptime[i] = strtoul(pstr,&pstr,0);
}
}

编译的时候就出现警告信息:assignment makes integer from pointer without a cast

因该是这段ptime[i] = strtoul(pstr,&pstr,0);出错了,但应该怎么改才不会啊.

[解决办法]
buff[len] ="\0"; 不对,用单引号。

热点排行