Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
// Creeaza fisierul text cu informatiile din fisierul binar de la 'creare_fisier.c'
typedef struct{
unsigned int an;
unsigned char luna;
unsigned char zi;
typedef struct{
char nume[20];
char cnp[14];
unsigned int nrm;
char fac[6];
unsigned char an;
unsigned int grupa;
char s;
char spec[11];
char note[20];
void main()
FILE* f;
FILE* g;
char numef[20];
int i, nr;
printf("Nume fisier: "); gets(numef);
f = fopen(numef, "rb");
if (!f)
printf("\nNu se poate deschide fisierul cu numele %s", numef);
g = fopen("Lista.txt", "wt");
fprintf(g, "\t\tLista studentilor\n");
fprintf(g, "Nrcrt %-19s Nrmat Fac. Specializare A Grupa S Data nast. Note", "Nume si prenume");
nr = 0;
fread(&x, sizeof(STUDENT), 1, f);
while (!feof(f))
fprintf(g, "\n%5d %-19s %5d %-5s %-12s %d %5d %c %2d.%2d.%4d ",
++nr, x.nume, x.nrm, x.fac, x.spec,, x.grupa, x.s,
x.d.zi, x.d.luna,;
for (i = 0; i < 20; i++)
fprintf(g, "%2d ", x.note[i]);
fread(&x, sizeof(STUDENT), 1, f);
printf("gata, apasa o tasta...");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.