Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #pragma pack(1)
- typedef struct
- {
- char nume_localitate[17];
- int nr_angajati;
- }FIRMA;
- #pragma pack()
- int main()
- {
- FIRMA p;
- FILE *f;
- if((f = fopen("exper.txt","rb")) == NULL)
- {
- printf("EROARE");
- exit(EXIT_FAILURE);
- }
- while(!feof(f))
- {
- fread(&p,sizeof(FIRMA),1,f);
- printf("%2s %d\n",p.nume_localitate,p.nr_angajati);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement