-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddress_book.h
64 lines (51 loc) · 1.13 KB
/
address_book.h
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
#pragma once
#ifndef _ADDRESS_BOOK_H_
#define _ADDRESS_BOOK_H_
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
// 매크로 정의
#ifndef MAX
#define MAX 1000
#endif
#ifndef PERSON_DATA_LEN
#define PERSON_DATA_LEN 70 /* 사람 1명의 데이터 크기 고정 */
#endif
#ifndef DATA_LEN_LIMIT
#define DATA_LEN_LIMIT 20
#endif
#ifndef FILE_NAME_LIMIT
#define FILE_NAME_LIMIT 50
#endif
// #define SAVE_MODE_TXT 1
#define SAVE_MODE_BIN 1
#if defined(SAVE_MODE_TXT)
#define FOUT_NAME "output.txt"
#elif defined(SAVE_MODE_BIN)
#define FOUT_NAME "output.bin"
#endif
// 구조체 정의
typedef struct Person {
int id;
uint8_t name[DATA_LEN_LIMIT];
uint8_t phone[DATA_LEN_LIMIT];
uint8_t address[DATA_LEN_LIMIT];
struct Person *next;
} Person;
// 전역 변수 선언
Person *head, *tail, *tmp;
FILE *fp;
int person_cnt; // 주소록에 등록된 사람 수
// 함수 선언
void clear_buffer();
void init_address_list();
void print_list();
void insert_list();
void insert_into_list();
void update_list();
void delete_list();
void load_file();
void save_file();
#endif