ok, I'm using fgets now in the code, and I try to save each line (only one word in each line) as an element in the array "flt" . but all elements of the array become the last line/word! I mean they all have one and the same string i.e. the last word in the file.
flt[0]=organisation
flt[1]=organisation
.
.
.
flt[7]=organisation !!!!
Code:
int main(){
char ch[20];
int i,j;
char* flt[8];
FILE *sep;
sep=fopen("hangman.dat","r");
for(i=0;i<2;i++){
fgets(ch,20,sep);
flt[i]=ch;
}
for(j=0;j<2;j++){
printf("%s",flt[j]);
}
fclose(sep);
return 0;
}