home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_08_04
/
8n04071a
< prev
next >
Wrap
Text File
|
1990-03-20
|
2KB
|
62 lines
*****Listing 1*****
1: /*
2: * MDB.H (Static-Array-Only Version)
3: *
4: * Program: Mini-Database
5: * Written by: Leor Zolman
6: * Module: Program Header File
7: */
8:
9: #define TRUE 1
10: #define FALSE 0
11:
12: /*
13: * Prototypes:
14: */
15:
16: int do_menu(struct menu_item *mnu, char *title);
17: void write_db(char *filename);
18: int read_db(char *filename);
19: void edit_db();
20: void fix_db();
21: void backup_db();
22: void error(char *msg);
23: struct record *alloc_rec(void);
24: void free_up();
25:
26: /*
27: * Data Definitions:
28: */
29:
30: struct record { /* Database record definition */
31: char active; /* TRUE if Active, else FALSE */
32: char last[25], first[15]; /* Name */
33: long id; /* ID Number */
34: int age; /* Age */
35: char gender; /* M or F */
36: float salary; /* Annual Salary */
37: };
38:
39: #define MAX_RECS 1000 /* Maximum number of records */
40:
41:
42: #ifdef MAIN_MODULE /* Make sure data is only */
43: #define EXTERN /* DEFINED in the main module, */
44: #else /* and declared as EXTERNAL in */
45: #define EXTERN extern /* the other modules. */
46: #endif
47:
48:
49: EXTERN struct record *recs[MAX_RECS]; /* Array of ptrs to */
50: #define RECS recs /* structs of type record */
51:
52: EXTERN int n_recs; /* # of records in current db */
53: EXTERN int max_recs; /* Max # of recs allowed */
54:
55: struct menu_item { /* Menu definition record */
56: int action_code; /* Menu item code */
57: char *descrip; /* Menu item text */
58: };
59: