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-03-2011, 07:42 PM #2
Tory Lanez
On bail right now
what exactly does this do Eek ??
03-03-2011, 07:52 PM #3
Originally posted by Nathanx View Post
what exactly does this do Eek ??


Replaces the system calls to pause and clear screen.
03-03-2011, 09:05 PM #4
Ritztro
I am a Game Developer
Originally posted by TheUberFail View Post
Replaces the system calls to pause and clear screen.


Lol this is kinda funny! I mean why not just use what they give you? Nice job anyway!
03-03-2011, 09:14 PM #5
Girby2K11
☮ ☯ ☢ ✔ ➝
conio.h

clrscr(); \\ is easier.

thanks too kiwimoosical
03-03-2011, 09:35 PM #6
Originally posted by Girby2K11 View Post
conio.h

clrscr(); \\ is easier.

thanks too kiwimoosical


Yes but this is another alternative.
03-03-2011, 09:38 PM #7
Nice dude ahah
03-03-2011, 11:22 PM #8
kiwimoosical
Bounty hunter
Originally posted by TheUberFail View Post
Yes but this is another alternative.


Your already including the conio.h header so why wouldn't you just use clscr. Also, use fgets rather than getch.
03-04-2011, 12:08 AM #9
Originally posted by kiwimoosical View Post
Your already including the conio.h header so why wouldn't you just use clscr. Also, use fgets rather than getch.


Why fgets?
03-04-2011, 12:11 AM #10
kiwimoosical
Bounty hunter
Originally posted by TheUberFail View Post
Why fgets?


Efficiency. With fgets you can also store it in char*/char[] of more than one char. But it still can be 1 char.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo