All pastes #18650 Raw Edit

Stuff

public text v1 · immutable
#18650 ·published 2005-07-27 18:52 UTC
rendered paste body
Header Code:
#include <stdio.h>
        struct person {
        char name[80];
        int age;
        char sex;
        int month;
        int day;
        int year;

        };

Program Code:
#include "/home/cordless/chomework/headerlib/dbstruct.h"

int main() {

	struct people read_database[10];

FILE *dbfile;
int i;

dbfile=fopen("mycensus.dat","rb");

fread(read_database,sizeof(struct people),10,dbfile);

	for (i=0;i<10;i++) {
		printf("Name: %s\nAge: %d\nSex: %c\nBirthDate: %d/%d/%d\n",read_database[i].name,read_database[i].age,read_database[i].sex,read_database[i].day,read_database[i].month,read_database[i].year);
	}
getchar();