typedef struct student{
char name[20];
char surname[20];
int semester;
int id;
} stcvor
typedef stcvor *pokz;
trebam napisati program koji ucitava n strukturnih promenjivih i koji zapisuje u datoteku student.txt
#include <stdio.h>
#include <stdlib.h>
main(){
int n,i, semestar, idnt;
char ime[20], prezime[20];
FILE * pokF;
int size = sizeof (struct student);
scanf("%d",&n);
for(i=1; i<=n; i++) {
scanf("%s/n", ime);
scanf("%s/n", prezime);
scanf("%d/n", &semestar);
scanf("%d/n", &idnt);
stcvor->name=ime;
stcvor->surname=prezime;
stcvor->semester=semestar;
stcovr->id=idnt;
pokF = fopen("student.txt","wb");
if (pokF == NULL)
{
fprintf(stderr, "Cannot open file for writing.\n");
}
fwrite(pokz, sizeof(pokz[0]), 1, pokF);
fclose(pokF);
}
}
kada ovo pokrenem dobijam gomilu gresaka ...
U cemu je problem
[Ovu poruku je menjao cobragangsta dana 08.07.2013. u 01:22 GMT+1]
[Ovu poruku je menjao cobragangsta dana 08.07.2013. u 02:45 GMT+1]