Witam.
mam liste na której pliki wyświetlam tak:
element showElements(element *head){
printf("\nIndex\tImie\tNazwisko\ttelefon\tnr.domu\n");
while(head != NULL){
printf("%i\t%s\t%s\t\t%s\t%i\n",
head->position,
head->imie,
head->nazwisko,
head->plec,
head->wiek,
(unsigned int)head->this,
(unsigned int)head->next );
head = head->next;
}
}
i wszystko jest ok..
a gdy chcę je zapisać na przykład tak:
FILE *fp =fopen("baza.txt", "w");
while(head != NULL){
fputs(head->imiefp);
head = head->next;
}
fclose (fp);
zapisuje tylko pierwsze imie, na reszcie są jakieś "ślaczki".
Domyślam sie, że chodzi o wskaźniki więc zrobiłem:
char a[20];
strcpy(a,head->imie);
i zapisywałem a.. ale też lipton..
Moze ktos mógłby poratować??