Kod:
//::::::::e-mail : y.sancar@mailcity.com::::::://
//:::::::yazým tarihi 27.04.2005 çarþamba:::::://
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>


/***********************************************************************************/
typedef struct _Person {
char name[15];
char sname[20];
char no[20];
int delflag;
int recno;
}Person;
/***********************************************************************************/
// bu i&#254;lev iki tane Person*  turunden nesneyi takas ediyor
void mswap(Person **p1, Person **p2)
{
Person *temp = *p1;
*p1 = *p2;
*p2 = temp;
}
/***********************************************************************************/
//bu i&#254;lev adresi verilen Person turunden bir nesneyi goruntuluyor
void display_per(Person *pper)
{
printf("%-15s %-20s: %s\n", pper->name, pper->sname, pper->no);
}

/***********************************************************************************/
//bu i&#254;lev dosyada bulunan en son kayd&#253;n kay&#253;t(recno) numaras&#253;n&#253;n geri donduruyor
//en son kay&#253;t&#253;n delflag degiskeni s&#253;f&#253;rlanm&#253;s bile olsa o kayd&#253;n nosu donuyor
int addno(void)
{
Person per;
FILE *fs;
int ch;

fs = fopen("PBook.ysn", "r");
if (fs == NULL) {
printf("dosya acilamiyor!!!\n");
exit(EXIT_FAILURE);
}

fseek(fs, 0L, SEEK_END);
ch = fseek(fs, -(long)sizeof(per), SEEK_CUR);
fread(&per, sizeof(per), 1, fs);

if (ch == EOF){
fclose(fs);
return 0;
}
else {
fclose(fs);
return  per.recno;
}
return -1;
}
/***********************************************************************************/
//bu i&#254;lev dosyan&#253;n sonuna bir kay&#253;t ilave ediyor
void madd()
{
FILE *fd = NULL;

Person per;
char name[15];
char sname[20];
char no[20];
int recno;

printf("isim:");
gets(name);
printf("soy isim:");
gets(sname);
printf("tel no:");
gets(no);

strcpy(per.name, name); //gerekli bilgiler kullan&#253;c&#253;dan per yap&#253;s&#253;ndan nesneye kopyalan&#253;yor
strcpy(per.sname, sname);
strcpy(per.no, no);
per.delflag = 1;
recno = addno() + 1;
per.recno = recno;
fd = fopen("PBook.ysn", "a+");

if (fd == NULL){
printf("%cDosya acilamaiyor!!!\n", 7);
exit(EXIT_FAILURE);
}

fwrite(&per, sizeof(per), 1, fd);  // per nesnesi dosyaya yaz&#253;l&#253;yor

fclose(fd);
}
/***********************************************************************************/
//bu i&#254;lev aranan ismi buluyor
void mfind(void)
{
char name[20];
Person per;
Person **pptr = NULL;
FILE *fs = NULL;
int index = 0;
int f_regno = 0;
int r_regno = 0;
int k = 0;
int equal = 0;


fs = fopen("PBook.ysn", "r");
if (fs == NULL){
printf("%cDosya acilamaiyor!!!\n", 7);
exit(EXIT_FAILURE);
}
rewind(fs);

printf("ismi girin:");
gets(name);
while (fread(&per, sizeof(per), 1, fs))  {
equal = 1;
if (per.delflag) {
for (k = 0; name[k] != '\0'; ++k) {
if (!(toupper(name[k]) == toupper(per.name[k])))
equal = 0;
}
if (equal) {
pptr = (Person **)realloc(pptr, sizeof(Person *) * (index + 1));
pptr[index++] = memcpy((Person *)malloc(sizeof(per)), &per, sizeof(per));
}
}
}

for (k = 0; k < index; ++k) {
printf("%-6d",k + 1);
display_per(pptr[k]);
}
if (!k) {
printf("\n%cisim kayitli degil!!!\n", 7);
getch();
system("cls");
return ;
}

printf("\n%c %d adet kayit bulundu\n", 4, index);
printf("----------------------------------------------------------\n");

for (k = 0; k < index; ++k) {
printf("%-6d",k + 1);
display_per(pptr[k]);
}
printf("----------------------------------------------------------\n");
for (k = 0; k < index ; ++k)
free(pptr[k]);
free(pptr);
fclose(fs);
}
/***********************************************************************************/
//bu i&#254;lev istenilen ki&#254;inin delflag bayrak degiskenini s&#253;f&#253;rl&#253;yor
//boylece gercekte silme yapmayacak silinmis muamelesi yap&#253;lacak
void mdel(void)
{
char name[20];
Person per;
Person **pptr = NULL;
FILE *fd = NULL;
int index = 0;
int f_regno = 0;
int r_regno = 0;
int k = 0;


fd = fopen("PBook.ysn", "r+");
if (fd == NULL){
printf("%cDosya acilamaiyor!!!\n", 7);
exit(EXIT_FAILURE);
}

printf("silinecek kisinin ismi:");
gets(name);

fseek(fd, 0L, SEEK_SET);
while (fread(&per, sizeof(per), 1, fd))
if (!strcmp(per.name, name) && per.delflag == 1) {
pptr = (Person **)realloc(pptr, sizeof(Person *) * (index + 1));
pptr[index++] = memcpy((Person *)malloc(sizeof(per)), &per, sizeof(per));
}
for (k = 0; k < index; ++k) {
printf("%-6d",++f_regno);
display_per(pptr[k]);
}
if (!k) {
printf("%cSilinebilecek isim kayitli degil!!!\n", 7);
getch();
system("cls");
return ;
}

printf("%c %d adet silinebilecek isim bulundu\n", 4, index);
printf("----------------------------------------------------------\n");
printf("Hangi sira numarali kayit silinecek:");
k = atoi(gets(name)) - 1;
pptr[k]->delflag = 0;   // silinecek kayd&#253;n delflag degiskeni s&#253;f&#253;rland&#253;
r_regno = pptr[k]->recno - 1; //silinecek  kay&#253;ttan bir onceki kayd&#253;n recno degeri al&#253;nd&#253;

printf("Silinecek kayit..........\n");
display_per(pptr[k]);

rewind(fd);   //dosya konum gostericisi en basa al&#253;nd&#253;
fseek(fd, +((long)sizeof(per) * r_regno), SEEK_CUR); // dosya konum gostericisi yaz&#253;lacak yere getirildi

fwrite(pptr[k], sizeof(per), 1, fd);
printf("Kayit silindi!!!\n");
fseek(fd, 0L, SEEK_CUR);

for (k = 0; k < index ; ++k)
free(pptr[k]);
free(pptr);
fclose(fd);

}
/***********************************************************************************/
//bu i&#254;lev kay&#253;t üzerinde de&#240;i&#254;tirme i&#254;lemi yap&#253;yor
void medit(void)
{
char name[20];
Person per;
Person **pptr = NULL;
FILE *fd = NULL;
int f_regno = 0;  //sahte kay&#253;t numaras&#253;
int r_regno;
int index = 0;
int k = 0;

fd = fopen("PBook.ysn", "r+");
if (fd == NULL){
printf("%cDosya acilamaiyor!!!\n", 7);
exit(EXIT_FAILURE);
}
printf("Lutfen kaydi duzletilecek kisinin ismini girin\n");
printf("isim:");
gets(name);

printf("\n\nSIRA %c  ISIM  %c      SOYISIM       %c        TEL. NO          %c\n", 187, 187, 187, 187);
printf("-----%c--------%c--------------------%c-------------------------%c\n", 188, 188, 188, 188);  

while (fread(&per, sizeof(per), 1, fd)) {
if (!strcmp(per.name, name)) {
pptr = (Person **)realloc(pptr, sizeof(Person *) * (index + 1));
pptr[index++] = memcpy((Person *)malloc(sizeof(per)), &per, sizeof(per));
}
}

for (k = 0; k < index; ++k) {
printf("%-6d",++f_regno);
display_per(pptr[k]);
}

if (!k) {
printf("%cDuzeltilebilecek isim kayitli degil!!!\n", 7);
getch();
system("cls");
return ;
}

printf("\n%c %d adet duzeltilebilecek isim bulundu\n", 4, index);
printf("----------------------------------------------------------\n\n");
if (index == 1) {
k = 0;
goto GIT;
}
printf("Hangi sira numarali kayit duzeltilecek:");
k = atoi(gets(name)) - 1;

GIT :
display_per(pptr[k]);

r_regno = pptr[k]->recno - 1; //duzletilecek kay&#253;ttan bir onceki kayd&#253;n recno degeri al&#253;nd&#253;
rewind(fd);
fseek(fd, +((long)sizeof(per) * r_regno), SEEK_CUR);

printf("duzeltilecek  bilgileri giriniz\n");
printf("isim:");
strcpy(per.name, gets(name));
printf("Soyisim:");
strcpy(per.sname, gets(name));
printf("numara:");
strcpy(per.no, gets(name));
per.recno = r_regno + 1;
per.delflag = 1;

display_per(&per);
fwrite(&per, sizeof(per), 1, fd);

for (k = 0; k < index ; ++k)
free(pptr[k]);
free(pptr);

fclose(fd);

}
/***********************************************************************************/
//bu i&#254;lev mevcut kay&#253;tlar&#253; listeliyor
void mdisplay(void)
{
Person per;
FILE *fd = NULL;
Person **pptr = NULL;
int k, i;
int index = 0;

fd = fopen("PBook.ysn", "r");
if (fd == NULL){
printf("%cDosya acilamaiyor!!!\n", 7);
exit(EXIT_FAILURE);
}

//kay&#253;tlar gosterici dizisine al&#253;n&#253;yor
while (fread(&per, sizeof(per), 1, fd))
if (per.delflag == 1) {
pptr = (Person **)realloc(pptr, sizeof(Person *) * (index + 1));
pptr[index++] = memcpy((Person *)malloc(sizeof(per)), &per, sizeof(per));
}
//al&#253;nan kay&#253;tlar s&#253;ralan&#253;yor
for (k = 0; k < index - 1; ++k)
for (i = 0; i < index - 1 - k; ++i)
if (strcmp(pptr[i]->name, pptr[i + 1]->name) > 0)
mswap(pptr + i, pptr + i + 1);

printf("\n\nSIRA %c  ISIM  %c      SOYISIM       %c        TEL. NO          %c\n", 187, 187, 187, 187);
printf("-----%c--------%c--------------------%c-------------------------%c\n", 188, 188, 188, 188);
for (k = 0; k < index; ++k){
printf("%-6d", k + 1);
display_per(pptr[k]);
}

for (k = 0; k < index ; ++k)
free(pptr[k]);
free(pptr);

fclose(fd);
printf("\n\n");
if (!index)
printf("%c\nHic kayit yok!!!\n\n", 7);
}
/***********************************************************************************/
void merase (void)
{
FILE *fs = NULL;

if (remove("PBook.ysn"))
printf("Kayitlar silinemedi!!!\n");

fs = fopen("PBook.ysn", "w");
if (fs == NULL) {
printf("dosya acilamiyor!!!\n");
exit(EXIT_FAILURE);
}
printf("\nKayitlar silindi...\n\n");
fclose(fs);

}
/***********************************************************************************/
void mabout (void)
{
printf("\n\t%c-------------------------------%c\n",203, 187);
printf("\t%cYazan   : Yasin SANCA%c         %c\n",204, 169, 206);
printf("\t%cE-posta : y.sancar@mailcity.com%c\n", 206, 206);
printf("\t%c-------------------------------%c\n\n", 200, 188);
}
/***********************************************************************************/

int main(int argc, char *argv[])
{
FILE *fd = NULL;
char sec[1];
int ch;

fd = fopen("PBook.ysn", "a+");
if (fd == NULL){
printf("%cDosya acilamaiyor!!!\n", 7);
exit(EXIT_FAILURE);
}
fclose(fd);
while (1) {
printf(" ..::TELEFON DEFTER&#221; PROGRAMI::.. \n\n" );
printf("\t\t\t\t\t Program (H)akkinda [H] \n", 3);
printf(" %c kayit   (E)kle     [E] \n", 3);
printf(" %c kayit   (S)il      [S] \n", 3);
printf(" %c kayit   (A)ra      [A] \n", 3);
printf(" %c kayit   (D)uzelt   [D] \n", 3);
printf(" %c tumunu  (L)istele  [L] \n", 3);
printf(" %c tumunu  (Y)sil     [Y] \n", 3);
printf("\n NE YAPMAK &#221;ST&#221;YORSUNUZ :"   );

gets(sec);
ch = toupper(sec[0]);

switch (ch) {
case 65 : mfind();break;
case 83 : mdel();break;
case 68 : medit();break;
case 69 : madd();break;
case 76 : mdisplay();break;
case 89 : merase();break;
case 72 : mabout();break;
default : printf("herhangi bir islem secmediniz!!\n");
}
}



return 0;
}

Programı oluşturan şahsa saygısızlık olmaması açısından kodlarda herhangi bir değişiklik yapılmadı.