I have the following code which is failing with EXC_BAD_ACCESS (code=1) and has the following warning:
Incompatible integer to pointer conversion passing 'int' to parameter of type '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 is being called by this code:
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");
Also, how can I convert the gets() to fgets() properly?
Thanks
printb()function parameters. Was that deliberate, or are you very new to C? - Greg Hewgill