我有以下代码因 EXC_BAD_ACCESS (code=1) 而失败,并有以下警告:
不兼容的整数到指针转换将“int”传递给“const char *”类型的参数
char *printb(fmt,a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10)
{
static char string[256];
sprintf(string,fmt,a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10);
return(string);
}
此代码正在调用 printb:
if (gotargs) fname = *(argv++);
else do {
printf("file name #%d: ", i+1);
fname = gets(inbuf);
} while (*fname == 0);
if ((gbuf=fopen(fname, "r")) == NULL)
error(printb("I can't find '%s'", fname));
printf("reading '%s'...\n", fname);
if (fgets((lp = inbuf), 512, gbuf) == NULL)
error("file is empty");
另外,我怎样才能正确地将 gets() 转换为 fgets() ?
谢谢