Menu

#24 added clreol() & delline() into CONIO.C

closed
nobody
None
5
2014-09-14
2001-11-18
Anonymous
No

I'm not quite sure these are 100% well written,
because I'm coding C for about 2 months now at school,
whitch isn't quite much.
So verify the code and tell me if there are
modifications to be done to do the same as with
Borland's CONIO.C

mail me @ :
michael.denecker.website@freegates.be
for any comment.

Just add this source into your CONIO.C
(in the 'include' dir of devc++)

void clreol( ) {

COORD coord;

DWORD written;
CONSOLE_SCREEN_BUFFER_INFO info;

GetConsoleScreenBufferInfo(GetStdHandle
(STD_OUTPUT_HANDLE), &info);
coord.X = info.dwCursorPosition.X;
coord.Y = info.dwCursorPosition.Y;

FillConsoleOutputCharacter (GetStdHandle
(STD_OUTPUT_HANDLE), ' ',
info.dwSize.X - info.dwCursorPosition.X *
info.dwCursorPosition.Y, coord, &written);
gotoxy (info.dwCursorPosition.X + 1,
info.dwCursorPosition.Y + 1);
}

void delline( ) {

COORD coord;

DWORD written;
CONSOLE_SCREEN_BUFFER_INFO info;

GetConsoleScreenBufferInfo(GetStdHandle
(STD_OUTPUT_HANDLE), &info);
coord.X = info.dwCursorPosition.X;
coord.Y = info.dwCursorPosition.Y;

FillConsoleOutputCharacter (GetStdHandle
(STD_OUTPUT_HANDLE), ' ',
info.dwSize.X * info.dwCursorPosition.Y, coord,
&written);
gotoxy (info.dwCursorPosition.X + 1,
info.dwCursorPosition.Y + 1);
}

Discussion

  • Andrew Westcott

    Andrew Westcott - 2001-11-21

    Logged In: YES
    user_id=301598

    Ha, I came here to submit some very similar code that
    appears to work perfectly from my tests. It goes a little
    something like this:

    void clreol() {
    COORD coord;
    DWORD written;
    CONSOLE_SCREEN_BUFFER_INFO info;
    GetConsoleScreenBufferInfo(GetStdHandle
    (STD_OUTPUT_HANDLE), &info);
    coord.X = info.dwCursorPosition.X;
    coord.Y = info.dwCursorPosition.Y;
    FillConsoleOutputCharacter(GetStdHandle
    (STD_OUTPUT_HANDLE), ' ',
    info.dwSize.X - info.dwCursorPosition.X, coord,
    &written);
    gotoxy(coord.X, coord.Y);
    }

    Of course the clrscr() code is a dead giveaway for what
    these functions are supposed to look like, which is why I
    was surprised to find that they weren't implemented.

     
  • Hongli Lai

    Hongli Lai - 2002-04-26

    Logged In: YES
    user_id=37342

    Thanks! Your code is now merged with ours.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.