Thread: How to create a scrolling cmd window?

  1. #1
    Do you C what I C? jamesallen4u's Avatar
    Join Date
    Oct 2011
    Posts
    43

    How to create a scrolling cmd window?

    Hello,

    I have a question about compiling with MS-DOS. For example, if I execute this code:
    Code:
    #include <stdio.h>
    int main()
    {
        int k;
        
        system("cls");
    
        k = 0;
    
        while ( k < 20 )
        {
             printf("The Value of k = %3d\n\n",(k+1) );
             k = k + 1;
        }
    
        printf(\n\n);
    
    }
    I achieve this output:


    How to create a scrolling cmd window?-output-1-png


    As you can see, there is no scrolling bar and I can't even see the numbers above 11. Is there a way to fix this in the compiler settings or the code? Thanks.

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    You're obviously running the program from inside some kind of IDE... check it's settings... or... open cmd.exe and run the program from the OS...

  3. #3
    Do you C what I C? jamesallen4u's Avatar
    Join Date
    Oct 2011
    Posts
    43
    I have actually found the answer on another forum, superuser.com. Here it is as follows:

    ...but here in XP land (and for a few Windows versions before that) you can get to the properties you're looking for either by right-clicking the icon/shortcut you use to open the command prompt, or by left-clicking the icon in the top left corner of the command window. In Properties, go to the Layout tab and increase Screen buffer size: Height to some big number like 1000. If you do it that last way, when you click OK to exit the Properties dialog, it will ask if you want to make the settings the new default. Some variation on all that likely exists in Windows 7.
    Thanks.

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    One would not suspect that since in Win7, Vista, Xp and win2000 the default buffer size has always been 50 and the screen height has always been either 100 or 300.

    If you didn't know those settings were there... how'd they get changed?
    Last edited by CommonTater; 10-03-2011 at 08:25 PM.

  5. #5
    Do you C what I C? jamesallen4u's Avatar
    Join Date
    Oct 2011
    Posts
    43
    My net book was brought pretty recently and I am the only user so I think those settings were the default, again pretty surprising for win Xp and up.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. scrolling when mouse is in the outskirt of a window
    By btq in forum Windows Programming
    Replies: 5
    Last Post: 10-23-2002, 05:13 AM
  2. Can a DLL create a window?
    By RedLenses in forum Windows Programming
    Replies: 3
    Last Post: 05-21-2002, 10:00 PM
  3. Ncurses and WINDOW scrolling
    By birkoss in forum Linux Programming
    Replies: 0
    Last Post: 05-17-2002, 11:47 AM
  4. Cannot create SDL window!!(PLEASE HELP!)
    By SyntaxBubble in forum Game Programming
    Replies: 2
    Last Post: 05-08-2002, 04:04 PM
  5. scrolling of the window in c language graphics
    By denny in forum C Programming
    Replies: 7
    Last Post: 12-27-2001, 11:41 PM

Tags for this Thread