char *local_buffer, *buff;
fgets(buff, 1024, fp);
local_buffer=strtok(buff,'\t'); //Error is coming with this line
I have already tried passing a character variable instead of '\t', but still its showing the same error.
char *local_buffer, *buff;
fgets(buff, 1024, fp);
local_buffer=strtok(buff,'\t'); //Error is coming with this line
I have already tried passing a character variable instead of '\t', but still its showing the same error.
You're passing in a character constant (which is equivalent to an integer), not a string, for the second argument.
local_buffer=strtok(buff,'\t');
What you want instead is:
local_buffer=strtok(buff,"\t");
Try:
char *local_buffer, buff[1024];
fgets(buff, 1024, fp);
local_buffer=strtok(buff,"\t"); //Error is coming with this line
Explanation:
Double quotes ("") around characters represent a null-terminated C-style character string (char*
)
Single quotes ('') around a character represents a character (apparently int
)