Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdbool.h>
- #include <string.h>
- typedef struct
- {
- unsigned char id, idm, ido;
- char name [50];
- } Person;
- void check(FILE *fp, char str[])
- {
- int size;
- fseek(fp,0,SEEK_END);
- size=ftell(fp)/sizeof(Person);
- Person arr[size];
- fseek(fp,0,SEEK_SET); // lub rewind(fp);
- fread(arr, sizeof(Person), size, fp); // gdzie, rozmiar poj elem, ile elementow, skad
- bool found=true;
- char *pch=str;
- for(int i=0; i<size; i++)
- {
- for(int j=0; i<size; i++)
- if(arr[i].id=arr[j].idm || arr[i].id==arr[j].ido)
- found=false;
- if(found)
- {
- memcpy(pch, arr[i].id, 50); // do czego, z czego, ile
- pch+=50;
- *pch=",";
- pch=+1;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement