Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. It seems nobody here knows how to do this!!!

It seems nobody here knows how to do this!!!

Scheduled Pinned Locked Moved C / C++ / MFC
helpvisual-studiotutorial
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CreepingFeature
    wrote on last edited by
    #1

    Sorry for the post name :-O! A week ago I posted a topic on clearing the screen in dos! Got four replies, none of which worked! Here is the problem. I have the folowing code inside main(). cout << " Hi! I am dumb."; cout << endl; // Here I need the screen to clear the way BASIC used to clear it when you put cls() or something like that, cant remember now. // So that this next statment is printed on a clean dos screen! cout << " Hi! I am dumb."; cout << endl; Some one suggested to cls() but didn't mention the header, then someone else said to use clrscr() and #include conio but conio does not have any members with such name. Even the docs supplied with VS 7 Ent. do not have any refference to cls() or anything even closely resembling it! If some one actualy does know how to do this PLEASE HELP! If somebody was offended by this post I aplgs! But some times you should take the time to read your own posts to see if they make sence or compile proper! Thanks in advance.

    D A 2 Replies Last reply
    0
    • C CreepingFeature

      Sorry for the post name :-O! A week ago I posted a topic on clearing the screen in dos! Got four replies, none of which worked! Here is the problem. I have the folowing code inside main(). cout << " Hi! I am dumb."; cout << endl; // Here I need the screen to clear the way BASIC used to clear it when you put cls() or something like that, cant remember now. // So that this next statment is printed on a clean dos screen! cout << " Hi! I am dumb."; cout << endl; Some one suggested to cls() but didn't mention the header, then someone else said to use clrscr() and #include conio but conio does not have any members with such name. Even the docs supplied with VS 7 Ent. do not have any refference to cls() or anything even closely resembling it! If some one actualy does know how to do this PLEASE HELP! If somebody was offended by this post I aplgs! But some times you should take the time to read your own posts to see if they make sence or compile proper! Thanks in advance.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      CreepingFeature wrote: Got four replies, none of which worked! Were any of them FillConsoleOutputAttribute() and FillConsoleOutputCharacter()?


      "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

      T R 2 Replies Last reply
      0
      • D David Crow

        CreepingFeature wrote: Got four replies, none of which worked! Were any of them FillConsoleOutputAttribute() and FillConsoleOutputCharacter()?


        "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

        T Offline
        T Offline
        Tom Dziedzic
        wrote on last edited by
        #3

        I think I replied to your question or was it someone else's?? dunno well you should use system("cls"); it's fast, easy and painless.

        D 1 Reply Last reply
        0
        • T Tom Dziedzic

          I think I replied to your question or was it someone else's?? dunno well you should use system("cls"); it's fast, easy and painless.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          namethatnooneelsetook2 wrote: it's fast, easy and painless. It's also antiquated, inefficient, and reminiscent of Unix days. The system() function starts a complete command interpreter, which then executes the command. I cringe when I see solutions that have employed the system() function. There is virtually nothing it can do that can't be done better by a direct API call. I consider it to have died with Win16 and is kept on for backward compatibility with old 16-bit programs that are being converted.


          "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

          1 Reply Last reply
          0
          • D David Crow

            CreepingFeature wrote: Got four replies, none of which worked! Were any of them FillConsoleOutputAttribute() and FillConsoleOutputCharacter()?


            "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

            R Offline
            R Offline
            Rick York
            wrote on last edited by
            #5

            Those are what is used in Q99261. ;) __________________________________________ a two cent stamp short of going postal.

            D 1 Reply Last reply
            0
            • C CreepingFeature

              Sorry for the post name :-O! A week ago I posted a topic on clearing the screen in dos! Got four replies, none of which worked! Here is the problem. I have the folowing code inside main(). cout << " Hi! I am dumb."; cout << endl; // Here I need the screen to clear the way BASIC used to clear it when you put cls() or something like that, cant remember now. // So that this next statment is printed on a clean dos screen! cout << " Hi! I am dumb."; cout << endl; Some one suggested to cls() but didn't mention the header, then someone else said to use clrscr() and #include conio but conio does not have any members with such name. Even the docs supplied with VS 7 Ent. do not have any refference to cls() or anything even closely resembling it! If some one actualy does know how to do this PLEASE HELP! If somebody was offended by this post I aplgs! But some times you should take the time to read your own posts to see if they make sence or compile proper! Thanks in advance.

              A Offline
              A Offline
              Archer282
              wrote on last edited by
              #6

              Try this void ClearScreen() { HANDLE hSTDOut = GetStdHandle(STD_OUTPUT_HANDLE); COORD dwCoord; DWORD nLength; DWORD lpResult; CONSOLE_SCREEN_BUFFER_INFO Info; dwCoord.X = 0; dwCoord.Y = 0; // Get the console buffer info GetConsoleScreenBufferInfo( hSTDOut, &Info ); nLength = Info.dwSize.X * Info.dwSize.Y; // Fill the console with ' ' making it look like it has been cleared FillConsoleOutputCharacter( hSTDOut, ' ', nLength, dwCoord, &lpResult ); // Set the console cursor position to 0,0 SetConsoleCursorPosition( hSTDOut, dwCoord ); }

              1 Reply Last reply
              0
              • R Rick York

                Those are what is used in Q99261. ;) __________________________________________ a two cent stamp short of going postal.

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                I see that. What's your point?


                "When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups