how to clear screen in c - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

how to clear screen in c

mikecoonmikecoon Posts: 61Member
I want to be able to clear the screen after each input. how do i do this?
how do i implement the dos command 'cls' in my c program.
yes, i am a newbie.
«1

Comments

  • stoberstober Posts: 9,765Member ✭✭✭
    : I want to be able to clear the screen after each input. how do i do this?
    : how do i implement the dos command 'cls' in my c program.
    : yes, i am a newbie.
    :

    system("cls");

  • luckyklluckykl Posts: 28Member
    : : I want to be able to clear the screen after each input. how do i do this?
    : : how do i implement the dos command 'cls' in my c program.
    : : yes, i am a newbie.
    : :
    :
    : system("cls");
    :
    :

    [code]
    #include

    system("cls");
    [/code]

    :-)

    or with scrclr(); in conio.h

  • stoberstober Posts: 9,765Member ✭✭✭
    :
    : or with scrclr(); in conio.h
    :
    :

    that is non-anscii c so not all compilers will have that function.
  • luckyklluckykl Posts: 28Member
    [b][red]This message was edited by luckykl at 2003-9-13 5:47:14[/red][/b][hr]
    Correct :-)
  • eet349eet349 Posts: 1Member
    i think you mean non-[u]ANSI[/u] C
  • tienkhoanguyentienkhoanguyen houPosts: 158Member

    include<stdlib.h>

    system("cls")

  • tienkhoanguyentienkhoanguyen houPosts: 158Member

    I searched all over the internet with Google and found "stdlib.h" for download. Half of the time, you can just copy it onto your notepad and name the file stdlib.h then paste the content into that. So it is like downloading the file except you did it the hard way. Anyways, once you have made or download it, you just include it in your C program by typing #include<stdlib.h> So make sure your Windows path can reference where that file is located. Once your C program sees this you can use system("cls"); Also make sure you include the semicolon after the system("cls"); or else it would give you an error. #include<stdlib.h> does NOT need a semicolon. I hope that helps. Just email me at [email protected] if you want my first app in C that uses this clear command. Be warned, I am kind of a religious Jesus Christ fanatic. haha Well, I hope we can all live in peace and program the fastest best apps out there that makes us all happy! Amen. - Tien Khoa Nguyen

  • khaledelkhateebkhaledelkhateeb egyptPosts: 1Member

    What is the difference between get char( ); get che ( ); get ch( ) ; and get s();

  • tienkhoanguyentienkhoanguyen houPosts: 158Member

    Jesus Christ!hehe That is a lot of gets. Anyways, I only know part of the answer. getchar() should be in the stdio.h library and requires an enter key after your input. getch() seems to be in the conio.h and accepts only 1 key. It is process without having to press enter after wards.

  • DavidTheGreatDavidTheGreat IndiaPosts: 3Member

    @khaledelkhateeb said: What is the difference between get char( ); get che ( ); get ch( ) ; and get s(); getchar() takes one character getche() would also take one character but would not display it on the screen getch() is similar to getchar except that it is in conio.h gets() would take a whole string and store it in a character array

«1
Sign In or Register to comment.