pf = fopen(leggere_filename(partita), "r");
if (pf != NULL)
{
char line[256];
count = 0;
while (fgets(line, sizeof line, pf) != NULL) //read a line
{
if (count == 8) {
bool turno;
char *end_string;
char *string = strtok_s(line, "", &end_string);
while (string != NULL) {
if (atoi(string) == 1)
turno = true;
else
turno = false;
string = strtok_s(NULL, "", &end_string);
}
partita = scrivereturno(partita, turno);
}
hi, I need to take a string from the file and separate the numbers through the strtok_s
function. The program works but brings me warnings with this message:
char * string: incompatible integer to pointer conversion initializing 'char *' with an expression of type 'int'
,
and:
int strtok_s (): implicit declaration of function 'strtok_s' is invalid in C99.
How come? I will appreciate your help.