I'm trying to do Write a C program that displays a three option menu of: 1. Enter A Record, 2. Display List, 3. Terminate. Option 1 should ask for Last Name (character string up to 25 long), First Name (character string up to 25 long), Sex (enumerated data type of M/F), Grade (enumerated data type of A/B/C/D/F). The data should be placed in a structure and inserted into a linked list ordered by Last Name. Option 2 should list all records on the screen. Option 3 should write the linked list to a disk file and exit. When the program is invoked it should read the existing data in the disk file if it exists before displaying the menu. After options 1 and 2 are complete the menu should be displayed again.
I'm having an issues etting up the file to be read. ANd ideas this is what i have gotten so far.
CODE
#include <stdio.h>
#include <string.h>
#define FLASE 0
#define TRUE 1
#define Nlen 25
typedef struct person{
char FName [Nlen +1];
char LName [Nlen +1];
char Sex;
char Grade;
struct person *Next;
} PERSON;
void PrintList (PERSON*);
int DeletePerson;
PERSON* InsertNode (PERSON*, PERSON*);
main ()
{
PERSON *STU; //TEmp pointer used to creat list
char ANS; //User responce
int Len, //Name Length
Deleted; //True if requested item deleted
char FName [Nlen +1]; // first name
char LName [Nlen +1]; // lase name
char Grade, Sex;
FILE *fin;
fin = fopen( "data.dat", "rw");
PERSON *TOP = NULL; //Initialize top list point to Null
while (fscan(fin, %-*s %-*s %c %c\n, Nlen, STU->LName, STU->FName, STU->Sex,STU->Grade) != EOF){
getchar ();
getchar ();
return 0;
}