Post: Beating system pause and cls
03-03-2011, 07:40 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Replacements for system("PAUSE"); and system("CLS"); in C++.

    //antiSystem.h
#include <iostream>
#include <windows.h>
#include <conio.h>

using namespace std;

void cls()
{
DWORD n;
DWORD size;
COORD coord = {0};
CONSOLE_SCREEN_BUFFER_INFO csbi;
HANDLE h = GetStdHandle ( STD_OUTPUT_HANDLE );
GetConsoleScreenBufferInfo ( h, &csbi );
size = csbi.dwSize.X * csbi.dwSize.Y;

FillConsoleOutputCharacter ( h, TEXT ( ' ' ), size, coord, &n );
GetConsoleScreenBufferInfo ( h, &csbi );
FillConsoleOutputAttribute ( h, csbi.wAttributes, size, coord, &n );

SetConsoleCursorPosition ( h, coord );
return;
}

void pause()
{
cout<<"Press any key to continue . . .";
getch();
cout<<endl;
return;
}
(adsbygoogle = window.adsbygoogle || []).push({});
03-04-2011, 12:52 AM #11
Originally posted by kiwimoosical View Post
Efficiency. With fgets you can also store it in char*/char[] of more than one char. But it still can be 1 char.


what library is fgets in?
03-04-2011, 01:57 AM #12
kiwimoosical
Bounty hunter
Originally posted by TheUberFail View Post
what library is fgets in?


#include <stdio.h>

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo