Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 132,350 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,136 people online right now. Registration is fast and FREE... Join Now!




Help could any one look to my code and answer my question?

 
Reply to this topicStart new topic

Help could any one look to my code and answer my question?

T&T
post 21 Aug, 2008 - 03:18 AM
Post #1


New D.I.C Head

*
Joined: 19 Aug, 2008
Posts: 2

[size=3] 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,

CODE
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
        }
}
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 11/22/08 03:58AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month