Thread: Modified clrscr function

  1. #1
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669

    Question Modified clrscr function

    Hi!

    I have modified the clrscr function, which I found it in the FAQ, and now I'm asking you guys is this modified function fast for clearing the screen?

    Code:
    void clrscr (short x, short y, short LengthErase, short NoOfLinesToErase)
    {
    	COORD coord;
    	DWORD cCharsWritten;
    	CONSOLE_SCREEN_BUFFER_INFO csbi;
    	HANDLE hOutput;
    	short i = 0;
    
    	hOutput = GetStdHandle (STD_OUTPUT_HANDLE);
    
    	for (i = 0; i <= NoOfLinesToErase; i++)
    	{
    		coord.X = x;
    		coord.Y = y+i;
    		FillConsoleOutputCharacter (hOutput, TEXT (' '), LengthErase, coord, &cCharsWritten);
    		GetConsoleScreenBufferInfo (hOutput, &csbi);
    		FillConsoleOutputAttribute (hOutput, csbi.wAttributes, LengthErase, coord, &cCharsWritten);
    	}	
    }
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

  2. #2
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669
    That's a good one Salem. I'll try and let you know.
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

  3. #3
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669
    This function is very fast. The time was 0.00003 s.
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Troubleshooting Input Function
    By SiliconHobo in forum C Programming
    Replies: 14
    Last Post: 12-05-2007, 07:18 AM
  2. Bisection Method function value at root incorrect
    By mr_glass in forum C Programming
    Replies: 3
    Last Post: 11-10-2005, 09:10 AM
  3. Change this program so it uses function??
    By stormfront in forum C Programming
    Replies: 8
    Last Post: 11-01-2005, 08:55 AM
  4. Replies: 5
    Last Post: 02-08-2003, 07:42 PM
  5. I need help with passing pointers in function calls
    By vien_mti in forum C Programming
    Replies: 3
    Last Post: 04-24-2002, 10:00 AM