Messing around with atoi from grabbing a number off of a file. First is there a way to just grab it off the file in the form of an int instead of a string? If so that's easier than my method. If not...with my current program I'm getting an error stating...
"passing arg 1 of 'atoi' from incompatible pointer type"
How can I fix this?
Code:
int main(void)
{
FILE *fp;
char buffer[50];
char *number;
int i;
fp = fopen("file04.txt", "r");
while (fgets(buffer, sizeof(buffer), fp)!=NULL)
{
sscanf(buffer,"%s", &number);
i = atoi(&number);
}
fclose(fp);
}