Hello,
I need your help in updating the loop in this code.
the purpose of this loop is to open and read all data file in the programme area that has a name (passenger xxxx) where x is any number from 0 to 9 .
please help me,
void Print_allPass()
{
FILE *infile;
char ID[5]="1000",temp[20],line[100],*status;
while( ( strcmp(ID,"0000") > 0 ) && ( strcmp(ID,"9999") < 0) ){
strcpy (temp ,"passenger");
strcat (temp ," ");
strcat (temp , ID);
infile = fopen (temp,"r");
if(infile != NULL ){
status = fgets(line, 100, infile);
while (status != NULL) {
puts(line);
status = fgets(line, 100, infile);
}}
// how can I update this loop
}
}