I have the base of the program working.
Code:
#include <stdio.h>..
#include <string.h>
#include <stdlib.h>
int main() {
FILE *fp;
struct ymd {
int year, month, day;
char name[50];
} birth, birth2, *p;
p = &birth2;
printf("What's your name? ");
fgets(p->name, sizeof(p->name), stdin);
printf("\nWhat's your year of birth?(xxxx): ");
fscanf(stdin, " %d", &birth.year);
printf("\nWhat is your birth month?(xx): ");
fscanf(stdin, " %d", &birth.month);
printf("\nWhat is your birth day?(xx): ");
fscanf(stdin, "%d", &birth.day);
if((fp = fopen("bday_dbase.txt", "a")) == NULL) { printf("Error opening file.");..
exit(1);..
} else {
fprintf(fp, "%s %d %d %d\n", p->name, birth.year, birth.month, birth.day);..
}
return 0;
}
I have never used a linked list before so I don't exactly know how to tie it into what I have. And sorry about the INDENTATION but I don't have a computer and I'm working on getting a laptop. A $300 HP on lay away.