Cool! Thanks for your help dude. I modified my code with your suggestions and Im getting alot of errors. Heres my code below so you can check it out and see if I should have taken out somehting, or added somehting, or put somehting in the wrong place, something. lol Thanks for your help man. I cant tell youhow much I appreciate this.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct family {
char name [50]; /* person's name */
char street [50]; /* street address */
char csz [50]; /* city, state, zip */
char relation [50]; /* relation to you */
char birthday [50]; /* mm-dd-yy */
char age [50]; /*person's age */
};
struct family PEOPLE[5], *member;
void main (void)
{
char linein[50];
char getdata[50];
int index;
FILE *in, *out;
index = 0;
in = fopen ("a:\\family.in", "r");
/* out = fopen ("a:\\family.out", "w"); */
while(inputRecord(PEOPLE, index) != NULL)
{
fgets(linein, 50, in);
getdata[index]=linein[50];
printf("%s", linein);
index++;
fprintf(out, " %s \n", linein);
}
printf("\n\nThe value is: %s\n\n", getdata[1]);
int inputRecord(struct *people, int i){
if(fgets(people[i].name, sizeof(people[i].name), in) == NULL)
return NULL;
fgets(people[i].street, sizeof(people[i].street), in);
fgets(people[i].csz, sizeof(people[i].csz);
fgets(people[i].relation, sizeof(people[i].relation);
fgets(people[i].birthday, sizeof(people[i].birthday);
fgets(people[i].age, sizeof(people[i].age);
return 1;
}
void outputRecord(struct *people, int i){
fprintf(out, "%s\t\t\tRelation:\t%s", people[i].name, people[i].relation);
fprintf(out, "%s\t\t\tBirthday:\t%s", people[i].street, people[i].birthday);
fprintf(out, "%s\t\t\tAge:\t%s", people[i].csz, people[i].age);
}
fclose(in);
fclose(out);
}