Friday, April 22, 2005

free(cs1101c);

#include
#include

#define FILENAME "extams_timetable.txt"

struct exam_schedule
{
char module[10];
struct exam_schedule *next;
};

typedef struct exam_schedule exams;

int main(void)
{
exams * paper, *head, *ptr, *tale;
FILE *infile;
infile=fopen(FILENAME, "r");

paper=(exams *) malloc(sizeof(exams));
ptr=head=paper;

if(paper!=NULL && infile!=NULL)
{
while(fscanf(infile,"%s", paper->module)==1)
{
paper->next=(exams *) malloc(sizeof(exams));
tale=paper;
paper=paper->next;
}
free(paper);
paper=head;
ptr=end;
ptr->next=NULL;
}
else
printf("Where is your bloody file? Are you sure about the existence of such file?\n");

/* after 22 April 1430 -1630 CS1101C */

ptr=head;
head=head->next;
ptr->next=NULL;
printf("The %s paper is done! Focus on %s paper!\n", ptr->module, head->module);

free(ptr);
ptr=head;

return 0;

}


infile: exams_timetable.txt
CS1101c
PC1432
EG1413
EG1108
MA1506
SSA2211
---------------------
~@££ tH3 !3esT~

Google
 

0 Comments:

Post a Comment

<< Home

Watch the latest videos on YouTube.com