C++ Notları

Page 160

if (rename("temp", fname)) { printf("fatal Error: cannot delete database file!..\n"); exit(EXIT_FAILURE); } if ((f = fopen(fname, "r+b")) == NULL) { printf("Fatal Error : Cannot open database file!..\n"); exit(EXIT_FAILURE); } printf("Pack operation succesfully completed!..\n"); } void main() { char dfname[MAX_PATH]; int option; printf("Data File : "); gets(dfname); if ((f = fopen(dfname, "r+b")) == NULL) if ((f = fopen(dfname, "w+b")) == NULL) { printf("Cannot open database file!..\n"); exit(EXIT_FAILURE); } strcpy(fname, dfname); for (;;) { option = GetOption(); switch (option) { case ADDREC : AddRec(); break; case LISTREC : ListRec(); break; case FINDREC : FindRec(); break; case DELREC : DelRec(); break; case EDITREC : EditRec(); break; case PACKRECS : Pack(); break; case SORTREC : SortRec(); break; case EXITPROG : goto EXIT; case INVALID : printf("Geçersiz Seçenek!..\n"); } } EXIT: fclose(f); } Uygulama 2: developer's back up programı (G. Aslan) #include <stdio.h> #include <stdlib.h> #include <string.h> #include <io.h> #include <errno.h> #define #define

GOOD FAIL

0 (-1)


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.