Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++] How to make it freeze on cmd window?
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Sun Sep 28, 2008 10:47 am    Post subject: Reply with quote

noz3001 wrote:
Code:
lol:
 goto lol;
Too many characters to be written, use:
Code:
for(;;);


@Fredd: .sync discards all the characters in the input buffer, so there won't be any newlines. Then .ignore works kinda the same as you'd be reading from the keyboard with .get or something, but instead of storing the read stuff, it just ignores them.
Back to top
View user's profile Send private message
deleted19776
I post too much
Reputation: 11

Joined: 29 Apr 2007
Posts: 3838

PostPosted: Sun Sep 28, 2008 11:07 am    Post subject: Reply with quote

Dude.., why are you talking about loop statements here?
@GMZorita:
I heard that System("PAUSE"); is not a good idea for some reason...
Back to top
View user's profile Send private message
manc
Grandmaster Cheater
Reputation: 1

Joined: 16 Jun 2006
Posts: 551

PostPosted: Sun Sep 28, 2008 11:09 am    Post subject: Reply with quote

waxxup wrote:

@GMZorita:
I heard that System("PAUSE"); is not a good idea for some reason...


It will get the job done, no doubt, just not as efficiently. Also, it will leave "Press any key to continue...." on your screen which is annoying.

_________________
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Sun Sep 28, 2008 11:21 am    Post subject: Reply with quote

waxxup wrote:
Dude.., why are you talking about loop statements here?
@GMZorita:
I heard that System("PAUSE"); is not a good idea for some reason...


Because if you shove a loop at the end it will never close. I was joking about the goto thing though. Just don't use system.
Back to top
View user's profile Send private message MSN Messenger
DeletedUser14087
I post too much
Reputation: 2

Joined: 21 Jun 2006
Posts: 3069

PostPosted: Sun Sep 28, 2008 12:18 pm    Post subject: Reply with quote

FUCK!, do this:

for(;;)Sleep(10); //2 semicolon(girls) 1 line(cup)
Back to top
View user's profile Send private message
deleted19776
I post too much
Reputation: 11

Joined: 29 Apr 2007
Posts: 3838

PostPosted: Sun Sep 28, 2008 2:24 pm    Post subject: Reply with quote

Also, how come SYSTEM is not a valid identifier because it gives me compiling errors when i tried it. Should i put another #include on there? If yes, then tell me what it is, I did put #include <iostream> and #include <string>.
Back to top
View user's profile Send private message
scuba111223
Master Cheater
Reputation: 0

Joined: 10 Sep 2008
Posts: 275

PostPosted: Sun Sep 28, 2008 2:53 pm    Post subject: Reply with quote

add #include <stdlib.h> and try making SYSTEM all lowercase, that might do the trick.
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Sun Sep 28, 2008 3:41 pm    Post subject: Reply with quote

Rot1 wrote:
FUCK!, do this:

for(;;)Sleep(10); //2 semicolon(girls) 1 line(cup)


Code:
for(;;Sleep(10));
Back to top
View user's profile Send private message MSN Messenger
nog_lorp
Grandmaster Cheater
Reputation: 0

Joined: 26 Feb 2006
Posts: 743

PostPosted: Mon Sep 29, 2008 2:45 pm    Post subject: Reply with quote

Code:
do{}while(1);


Also, a note:
If you are trying to make the process block, efficiency does not matter. Unless adding a couple bytes to your program's length for the string pushes it beyond the executable size limit or something ridiculous like that.
The real reason not to use system("pause"); is because it is ugly.

~nog_lorp

_________________
Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
Back to top
View user's profile Send private message
Wintermoot
Expert Cheater
Reputation: 0

Joined: 08 Nov 2007
Posts: 198

PostPosted: Tue Sep 30, 2008 9:28 am    Post subject: Reply with quote

Code:

while(1){}


Code:

for(;;){}


I win now?

My view is that right now, people don't need to be the few milliseconds faster or the few bytes smaller. Yes, size does matter but, only big differences. (Like compiling in Release and not Debug...)
Back to top
View user's profile Send private message
Nuclear898
Grandmaster Cheater Supreme
Reputation: 0

Joined: 04 Jun 2006
Posts: 1597
Location: The Netherlands

PostPosted: Tue Sep 30, 2008 9:58 am    Post subject: Reply with quote

Use get

cin.sync()
cin.ignore()

Or else it would take 300mb RAM to run your program... Rolling Eyes

When you use System("pause") people actually know they have to press a key to continue, unless it's just for testing but you could also print that yourself though...

Code:
printf("Press any Key to continue...\n")
Back to top
View user's profile Send private message
Noz3001
I'm a spammer
Reputation: 26

Joined: 29 May 2006
Posts: 6220
Location: /dev/null

PostPosted: Tue Sep 30, 2008 11:30 am    Post subject: Reply with quote

system("pause"); is like using cooking oil to run your car. It might be cheaper and easier to get but it could fuck your car and would probably stink of shit.

You're already using iostream so just use sync() ignore().
Back to top
View user's profile Send private message MSN Messenger
nwongfeiying
Grandmaster Cheater
Reputation: 2

Joined: 25 Jun 2007
Posts: 695

PostPosted: Tue Sep 30, 2008 8:34 pm    Post subject: Reply with quote

noz3001 wrote:
system("pause"); is like using cooking oil to run your car. It might be cheaper and easier to get but it could fuck your car and would probably stink of shit.

You're already using iostream so just use sync() ignore().


That's a nice analogy; never would of thought of it like that.
Back to top
View user's profile Send private message
Chidori
Grandmaster Cheater
Reputation: 1

Joined: 25 Apr 2008
Posts: 691
Location: Canada

PostPosted: Wed Oct 01, 2008 5:30 pm    Post subject: Reply with quote

waxxup wrote:
slovach wrote:
cin.sync()
cin.ignore()

Thank you!!!
And i won't make the common mistake of not putting ";" at the end of lines Rolling Eyes.
im new at this so the code is // operating with variables

#include <iostream>
using namespace std;

int main ()
{
// declaring variables:
int a, b;
int result;

// process:
a = 5;
b = 2;
a = a + 1;
result = a - b;


// print out the result:
cout << result;

// terminate the program:
return 0;
}
where do i put in the cync thingy,that pauses the program
Back to top
View user's profile Send private message AIM Address MSN Messenger
scuba111223
Master Cheater
Reputation: 0

Joined: 10 Sep 2008
Posts: 275

PostPosted: Wed Oct 01, 2008 7:39 pm    Post subject: Reply with quote

im pretty sure they go right above return 0;

//terminate the program:
cin.sync();
cin.ignore();
return 0;
}

i think its suppose to look like that
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites