Problem with clrscr()

Discussion in 'C++' started by AHR, Jan 26, 2004.

  1. AHR

    AHR Guest

    Hi NG

    I am learning MFC but only use the command promt at the moment to run my C++
    programs.

    My problem is that i cant use clrscr() even if i include <conio.h>.

    I get this error:

    ****
    error C2065: 'clrscr' : undeclared identifier
    ****

    Can anyone help?

    Thanks
    AHR
     
    AHR, Jan 26, 2004
    #1
    1. Advertisements

  2. AHR

    John Carson Guest

    "AHR" <> wrote in message
    news:401507df$0$95018$
    > Hi NG
    >
    > I am learning MFC but only use the command promt at the moment to run
    > my C++ programs.
    >
    > My problem is that i cant use clrscr() even if i include <conio.h>.
    >
    > I get this error:
    >
    > ****
    > error C2065: 'clrscr' : undeclared identifier
    > ****
    >
    > Can anyone help?
    >
    > Thanks
    > AHR



    Your question is off-topic in this newsgroup since it is system specific.
    The newsgroup

    microsoft.public.vc.language

    is the best place to ask (or you could try microsoft.public.vc.mfc).

    The reason why you are getting the "undeclared identifier" message is
    because clrscr is neither part of the C++ standard nor a Microsoft extension
    to the C++ standard. Thus the function does not exist on your compiler. You
    might try

    system("cls");


    --
    John Carson
    1. To reply to email address, remove donald
    2. Don't reply to email address (post here instead)
     
    John Carson, Jan 26, 2004
    #2
    1. Advertisements

  3. AHR

    ensvhiiotus_17

    Joined:
    Aug 7, 2008
    Messages:
    2
    Likes Received:
    0
    Really Works Dude!... Thanks For All...

    eLow!... dude., it really works with what is suggested by Mr. John Carson....
    it works with my Microsoft Visual C++ 6.0 Standard Edition and im sure it'LL work also with other edition like Enterprise Edition and the like...
    here is a example:...

    #include < conio.h>
    #include <stdlib.h> /*stdlib.h is somewhat compulsory by the way and
    not necessary but i would suggest to include it...*/
    ...
    main()
    {
    ...
    system("cls");

    note that as this is a command, it must appear after your variable
    declarations like "main()".

    :veryprou:
     
    Last edited: Aug 7, 2008
    ensvhiiotus_17, Aug 7, 2008
    #3
  4. AHR

    ensvhiiotus_17

    Joined:
    Aug 7, 2008
    Messages:
    2
    Likes Received:
    0
    In Addition....

    for those c programming language like that of Turbo Pascal.,
    here is a example:...


    Program example;
    uses Crt;
    ...
    begin
    writeln('Press any key to clear the screen');
    readln; /* or it can be "readkey;" */
    clrScr;
    writeln('Have fun with the cleared screen');
    end.
    :veryprou:
     
    ensvhiiotus_17, Aug 7, 2008
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Suurkuusk
    Replies:
    0
    Views:
    4,254
    Andreas Suurkuusk
    Jul 27, 2003
  2. Ted Miller
    Replies:
    0
    Views:
    5,510
    Ted Miller
    Sep 13, 2003
  3. Merek
    Replies:
    0
    Views:
    2,174
    Merek
    Dec 3, 2003
  4. Dfschweiss
    Replies:
    1
    Views:
    503
    Michiel Salters
    Dec 1, 2004
  5. Michele 'xjp'

    POSIX and getch(), clrscr()

    Michele 'xjp', Jul 20, 2007, in forum: C++
    Replies:
    8
    Views:
    1,614
    Thomas Dickey
    Jul 27, 2007
  6. Replies:
    1
    Views:
    905
  7. Mike

    Problem problem problem :( Need Help

    Mike, May 7, 2004, in forum: ASP General
    Replies:
    2
    Views:
    804
    Bullschmidt
    May 11, 2004
  8. vikaskumar sharma

    How to clear screen (as clrscr in c) in java?

    vikaskumar sharma, Oct 6, 2012, in forum: Java
    Replies:
    9
    Views:
    2,338
    Knute Johnson
    Oct 7, 2012
Loading...