Thread: I just figured this method out.

  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, 07:01 AM
  4. Overriding a method in C
    By DavidDobson in forum C Programming
    Replies: 1
    Last Post: 07-05-2008, 07:51 AM
  5. Replies: 2
    Last Post: 01-22-2008, 04:22 PM