{
char word[MAX_WORD_LEN];
// for (int i = 0; i < 1000; i++)
{
int i = 0;
fd_array[i] = fd;
FILE* fdd;
fdd = fd_array[0];
// FILE* fdd;
// fdd = fd_array[i];
fscanf(fdd, "%s", word);
printf("here : %s\n",word);
fscanf(fd_array[0], "%s", word);
printf("here : %s\n",word);
}
return;
}
here fd passed into the function has the pointer to first position of file. fd_array is a global array of type FILE*.
Why are both the printf printing different things when i have here used only a copy of the file pointer
output:
here : the
here : of
the file from which i am reading is a text file with a word in each line the first two lines have the following words:
the
of