answersLogoWhite

0

It isn't used. Or at least it shouldn't be used. The clrscr() function is made available through the non-standard header, however not all C implementations support it. The header provides access to console input/output functions that are specifically intended for MS-DOS console applications (and are therefore non-portable), however the header is not defined consistently across all implementations. For instance, Borland (now Embarcadero) provides a clrscr() function via its header but Microsoft does not.

The clrscr() function was intended to "clear the screen" which cleared all output from the screen and reset the output cursor to the top-left position ready for new output. These days we don't work with a screen, we work with a "command window", but it's the same thing as far as the clrscr() function is concerned.

The reason clrscr() is not a standard function is because console applications don't actually have any need for a clrscr() function. Aside from anything else, it is considered bad form to clear the screen without user-consent. If the user wishes to clear the screen they can simply invoke the CLS command via the DOS command line prior to invoking your program. At least then they have made a conscious decision to clear the screen. However, more importantly, it is never safe to assume that console output is actually being directed to a screen; the user must be free to redirect console output wherever they desire, whether to a disk file, a printer or even as input for another program. A console program that does not allow this freedom of choice is not a console program.

Of course there will be cases where a program must use the screen. For instance, a DOS video game wouldn't be much use if the user could redirect output to a printer or a disk file. However, a DOS video game is not a console application and should not be treated as such. Moreover, it is important that the game leave the screen exactly as it found it when the program terminates. These days that is more easily achieved by opening a new window, but in a single-task MS-DOS environment a well-behaved program must save the current console state at runtime and restore that state upon exit.

User Avatar

Wiki User

9y ago

What else can I help you with?

Related Questions

What is conio. h?

conio.h is a header file used in C and C++ programming, particularly in DOS-based systems. It provides functions for console input and output, such as gotoxy() for cursor positioning and clrscr() for clearing the screen. Although it was widely used in older compilers like Turbo C++, it is not part of the standard C library and is largely considered obsolete in modern programming environments.


Why Clearscreen in c language is used?

'Clearscreen' is not used in C language. TurboC has a clrscr function (prototype in conio.h).


Why do we have to use uses crt or clrscr in pascal programming language?

No, you don't have to.


What is the C language used for?

Programming.


What is the alternate function for clrscr function in c language?

What do you mean by \'alternate function of clrscr\'? A function that undoes clrscr? Or one that fills the screen with random characters? Anyway, clrscr is not part of the standard C library, it is DOS-specific.


What is a C compiler as used in C programming?

In C programming, C compiler is user to translate C source into C object module.


Why you are using clrscr in c language?

Function 'clrscr' is not part of the C language. Or the standard libraries. It is MS-DOS specific function, use the help for details (clrscr means clear the screen).


What is C language used for?

Programming.


C A programming language widely used for systems programming?

Yes.


What is better turbo c or dev C?

Depends upon the personal opinion. They both are different IDE. Dev C used the MICGW compiler while Turbo C uses Borland compiler. Hence due to this, certain inbuilt functions will not work in Dev C. clrscr() is one such function. However Turbo C is outdated and does not use follow many of the programming standards.


Where you use clrscr command?

The clrscr command is used in programming, particularly in older versions of languages like Turbo C or Borland C++, to clear the console screen. This command helps improve the readability of the output by removing previous text and providing a clean slate for new information. It's often employed in console applications to enhance user experience, especially in situations where the output changes frequently. However, in modern programming environments, alternative methods, such as ANSI escape codes or built-in functions, are typically preferred for similar functionality.


Why are use c language?

For is it programming used.