help function

This is a discussion on help function within the C++ Programming forums, part of the General Programming Boards category; Hi guys, I got a quick and easy question... How would I do the following: Open a text file up ...

  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, 04:06 PM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 02:01 AM
  4. Replies: 28
    Last Post: 07-17-2006, 12:35 AM
  5. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 07:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21