use of clrscr()
Posted on 2004-07-30
I wrote a code in C that sorts files according to their names, size, date etc. The results are displayed on the output console. Inputs to the console are also requested from the user via a menu display. I've used clrscr() at various points in the code to get a better organized display. Some random errors were showing up in some of my sort result displays. Zeros were appearing in date and time values where there were no zeros previously. At times one file may seem to have not been sorted. After verifying that relevant functions were correct I noticed that removing and relocating some clrscr() solved the problem. I learned on the web that clrscr clears the screen prior to writing to the terminal, it is a command and so must appear after variable declarations and it sets all character positions to blanks with the currently defined text. I'm having the display errors again in another program and would like any help on the correct use of the clrscr().
Using Borland C++ 5.02 application.