-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathRehber.c
67 lines (49 loc) · 1.08 KB
/
Rehber.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include<stdio.h>
#include<string.h>
int main()
{
FILE *fp;
struct rehber
{
char name[100];
char surname[100];
char num[100];
}kisi;
printf("Rehber Listesi\n");
int secim;
do
{
printf("********\n");
printf("1-Rehber Ekleme \n");
printf("2-Rehber Listeleme\n");
printf("3-Cikis \n");
printf("Islem seciniz: ");
scanf("%d",&secim);
if(secim==1)
{
printf("----------------\n");
fp=fopen("rehber.txt","a+");
printf("Name:");
scanf("%s",&kisi.name);
printf("Surname :");
scanf("%s",&kisi.surname);
printf("Phone number :");
scanf("%s",&kisi.num);
fwrite(&kisi,sizeof(kisi),1,fp);
printf("\n--------Kaydedilmistir--------\n\n");
}
fclose(fp);
if(secim==2)
{
fp=fopen("rehber.txt","rb+");
while(!feof(fp))//feof dosya sonu gostergesidir.
{
fread(&kisi,sizeof(kisi),1,fp);
if(feof(fp)) break;
printf("----------------\n");
printf("Name:%s\nSurname:%s\nPhone number:%s \n ",kisi.name,kisi.surname,kisi.num);
}
}
fclose(fp);
}while(secim!=3);
}