I just figured this method out.

This is a discussion on I just figured this method out. within the C++ Programming forums, part of the General Programming Boards category; This method is probably a cheap way to do it, but it works When you read a file in MSDOS, ...

  1. #1
    0x01
    Join Date
    Sep 2001
    Posts
    88

    I just figured this method out.

    This method is probably a cheap way to do it, but it works

    When you read a file in MSDOS, the text just scroll down the screen and you can't see what was there. Well this prints out 1000 characters of the file being viewed, then lets the user hit any key to see the next 1000 characters of the file, and so on.

    Simple code too. eh.

    #include "iostream.h"
    #include "stdio.h"
    #include "stdlib.h"
    #include "conio.h"

    int main()
    {
    int idx = 0;

    FILE *note;

    note = fopen("Filename.txt","r");

    if(!note)
    {
    printf("File NOT found.");
    }
    else
    {
    char c;

    while(c != EOF){
    idx++;
    c = fgetc(note);
    putchar(c);

    if(idx == 1000){
    printf("\n\n\t\t\t\t\t\tPress any key to continue...\n\n");
    getche();
    idx = 0;
    }
    }

    printf("\n\t\t\t\t\t\tPress any key to quit...");
    fclose(note);
    getche();
    }
    return 0;
    }

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    79
    dude, type in at the command line:
    "type file | more"

    (without the quotes)
    It even works in MS-DOS.
    All generalizations are false

  3. #3
    0x01
    Join Date
    Sep 2001
    Posts
    88
    hmm..i thought i knew pretty much all the commands in DOS, from "cd" to mapping a network drive, eh, learning new things everyday.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. on method pointers and inheritance
    By BrownB in forum C++ Programming
    Replies: 2
    Last Post: 03-02-2009, 07:50 PM
  2. stuck on display method
    By shintaro in forum C++ Programming
    Replies: 2
    Last Post: 02-01-2009, 05:17 PM
  3. C# method
    By siten0308 in forum C# Programming
    Replies: 6
    Last Post: 07-15-2008, 08:01 AM
  4. Overriding a method in C
    By DavidDobson in forum C Programming
    Replies: 1
    Last Post: 07-05-2008, 08:51 AM
  5. Replies: 2
    Last Post: 01-22-2008, 04:22 PM

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