Thread: clrscr() in msvc++?

  1. #1
    Registered User blight2c's Avatar
    Join Date
    Mar 2002
    Posts
    266

    clrscr() in msvc++?

    clrscr() isn't working in my msvc++ but it is in borland. do i have the right library, conio.h?

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793

    Re: clrscr() in msvc++?

    Originally posted by blight2c
    clrscr() isn't working in my msvc++ but it is in borland. do i have the right library, conio.h?
    Never ceases to amaze me.......... here

    Go with the "windows option"

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    MSVC++ doesn't have clrscr(). If you'd like to visit the FAQ you'll find a very nice screen clearing function that works with MSVC++.

    -Prelude
    My best code is written with the delete key.

  4. #4
    Registered User blight2c's Avatar
    Join Date
    Mar 2002
    Posts
    266
    Go with the "windows option"
    thanks, i thought the windows option was just for gui stuff.

    sorry to ask such lame question . . . did i at least inflate your self-esteem though?

  5. #5
    Registered User
    Join Date
    Apr 2002
    Posts
    52
    In MSVC++ I define cls and utilize it as a small function

    ie...

    Code:
    #include <iostream>
    #include <stdlib.h>         //included in this library
    
    #define CLS() SYSTEM("CLS")
    
    //when I want to clear the screen I enter...
    
    int main(void)
    {
    int a(0);
    cout << "Enter a number: ";
    cin >> a;
    
    CLS();
    
    cout << a;
    
    return 0;
    }
    This is way simple, but I've never had a problem this way. I hope that this helps you.

  6. #6
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by blight2c

    did i at least inflate your self-esteem though?
    Nope

    Sorry...didnt mean to jump down your throat........

  7. #7
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    Quoting Prelude: "The system function is godawful slow!"

  8. #8
    Registered User toaster's Avatar
    Join Date
    Apr 2002
    Posts
    161
    or you can transfer the library over.
    isn't MSDEV a development tool?
    you are not limited to the libraries provided.
    think only with code.
    write only with source.

  9. #9
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by toaster
    or you can transfer the library over.
    isn't MSDEV a development tool?
    you are not limited to the libraries provided.
    Yes you are limited in the respect that a library written or say Turbo C might implement say printf() by addressing the video memory and changing its values......this is OK for dos based programs and the relevant library will contain the code to do this.....

    But with windows you dont have direct access to video memory, so there is no way this code would work even if you got MSVC to accept the library....the MSVC library will implement printf() by processing the info given and then calling an API function (likely to be WriteConsoleOutput())....this API function then calls whatever lower level functions it need to actually change the video memory....

    As you can imagine, the actual code that MSVC uses to implement a function will be drastically different from that of another compiler.....So therefore unless the library was explicitly written for your compiler....you cant use it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trouble with MSVC, Mingw32 and Code::Blocks
    By Brafil in forum C Programming
    Replies: 11
    Last Post: 10-12-2009, 11:34 AM
  2. clrscr() in microsoft visual c++
    By canliceset in forum C++ Programming
    Replies: 7
    Last Post: 11-18-2004, 02:40 AM
  3. MSVC behaves strange
    By ripper079 in forum C++ Programming
    Replies: 4
    Last Post: 10-28-2003, 08:34 PM
  4. Blender3D, XML, and MSVC ???
    By Grumpy_Old_Man in forum Game Programming
    Replies: 0
    Last Post: 08-24-2003, 07:00 PM
  5. GCC (cygwin) much faster than MSVC, Borland?
    By Sargnagel in forum C Programming
    Replies: 15
    Last Post: 08-05-2003, 03:15 AM