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. Advertising

  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. Advertising

  3. AHR

    ensvhiiotus_17

    Joined:
    Aug 7, 2008
    Messages:
    2
    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
    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. Advertising

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. Jonathan Mcdougall

    Re: clrscr Compiler Independent functions

    Jonathan Mcdougall, Nov 23, 2004, in forum: C++
    Replies:
    0
    Views:
    358
    Jonathan Mcdougall
    Nov 23, 2004
  2. Dfschweiss
    Replies:
    1
    Views:
    404
    Michiel Salters
    Dec 1, 2004
  3. Michele 'xjp'

    POSIX and getch(), clrscr()

    Michele 'xjp', Jul 20, 2007, in forum: C++
    Replies:
    8
    Views:
    1,377
    Thomas Dickey
    Jul 27, 2007
  4. Replies:
    1
    Views:
    743
  5. vikaskumar sharma

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

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

Share This Page