Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include<stdio.h>
#include<conio.h>
#define NOGRADEYET 0
#define ABESNT -1
typedef struct{
unsigned int nrm;
char nume[30];
unsigned char ans;
unsigned int grupa;
char fac[6];
char note[20];
unsigned char is;// indicator stare( art liber / art valid )
}STUDENT;
void main()
{
FILE* f,*g;
STUDENT x;
int nrart, cheie, a, i;
char numefr[20] = "..\\SR.dat"; // Aparitie in folderul solutie (automatizeaza la mutarea manuala)
char numeft[20] = "..\\Lista1025.txt";
int nrct;
f = fopen(numefr, "rb");
if (!f)
printf("\nNu se poate deschide fisierul %s", numefr);
else
{
g = fopen(numeft, "wt");
fprintf(g,"\t\tLista studentilor");
fprintf(g, "\n\nNrcrt Nr mat %s-29s Fac. A Grupa", "Nume si prenume");
fread(&x, sizeof(STUDENT), 1, f);
while (!feof(f))
{
if (x.is == 1)
fprintf(g, "\n%5d %5d %-29s %-5s %d %5d", ++nrart, x.nrm, x.nume, x.fac, x.ans, x.grupa);
fread(&x, sizeof(STUDENT), 1, f);
}
fclose(g);
fclose(f);
printf("\nLista se aflta in fisierul %s", numeft);
}
printf("\nGata, apasa o tasta...");
getch();
}
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.