Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- printf("Dwste ISBN tou epi8umhtou bibliou pros daneismo:\n");
- gets(n);
- fp=fopen("books","r");
- while (( !feof(fp) ) && (found!=0) )
- {
- fread(&b,sizeof(b),1,fp);
- if (!feof(fp) && strcmp(n,b.isbn)== 0 )
- {
- found=0;
- printf("to biblio uparxei sth biblio8hkh:\n");
- printf("%s %s %d \n" ,b.isbn,b.titlos,b.antitupa);
- copies+=b.antitupa;
- printf("copies= %d\n",copies);
- fp2=fopen("daneismoi","a+");
- if (fp2==NULL)
- {
- printf("file not found!\n");
- break;
- }
- fseek(fp2, 0, SEEK_END); // seek to end of file
- int size = ftell(fp2);
- if (size==0)
- {
- printf("Empty file!\n");
- fclose(fp2);
- break;
- }
- fseek(fp2, 0, SEEK_SET);
- while ( !feof(fp2) )
- {
- fread(&d,sizeof(d),1,fp2);
- while (strcmp(n,d.isbn)== 0 )
- { copies--;
- }
- }
- fclose(fp2);
- printf("diathesima antitupa= %d\n", copies);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement