Thread: help function

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    14

    help function

    Hi guys,

    I got a quick and easy question...

    How would I do the following:

    Open a text file up with lots of text, like a help file and display like 25 lines or so and then press any key to continue, so people can actually read it.

    Is there any good ways to do this or what not?

    Thanks a lot

  2. #2
    Registered User Mario's Avatar
    Join Date
    May 2002
    Posts
    317
    Well... one way would be to read a line at a time and stop at the 25th line

    Code:
    char buffer[200];
    int counter=0;
    
    while (!myfile.eof())
    {
        if(counter=25){
            counter=0;
            system("pause");
        }
        myfile.getline (buffer,100);
        cout << buffer << endl;
        counter++;
    }
    Regards,
    Mario Figueiredo
    Using Borland C++ Builder 5

    Read the Tao of Programming
    This advise was brought to you by the Comitee for a Service Packless World

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    14
    thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  5. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 06:44 PM