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++ Starting
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
kitterz
Grandmaster Cheater Supreme
Reputation: 0

Joined: 24 Dec 2007
Posts: 1268

PostPosted: Mon Aug 11, 2008 2:13 pm    Post subject: Reply with quote

slovach wrote:
kitterz wrote:
dEEznutz wrote:

double edit: Hmm, I think it's working now because when I clicked start debugging it opened up a CMD and I got no errors. However, the cmd closed to fast for me to see anything. Is this what supposed to happen?


Or you can just use

Sleep ();


Er no, don't do this. It's just going to sit there, stalled and unresponsive until it's time is up.


not really...he is doing nothing else after the Sleep(), if he puts it there, so it should make no difference.
Back to top
View user's profile Send private message Send e-mail
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Mon Aug 11, 2008 2:19 pm    Post subject: Reply with quote

lurc wrote:
They just stop the command line and wait for user-input.

sync - Synchronize input buffer with source of characters
ignore - Extract and discard characters

(Taken from cplusplus)

Or he can use getchar; it does the same.
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: Mon Aug 11, 2008 3:27 pm    Post subject: Reply with quote

TraxMate wrote:
lurc wrote:
They just stop the command line and wait for user-input.

sync - Synchronize input buffer with source of characters
ignore - Extract and discard characters

(Taken from cplusplus)

Or he can use getchar; it does the same.


Why? He's using C++.
Back to top
View user's profile Send private message MSN Messenger
TraxMate
Master Cheater
Reputation: 0

Joined: 01 Mar 2008
Posts: 363

PostPosted: Mon Aug 11, 2008 3:39 pm    Post subject: Reply with quote

noz3001 wrote:
TraxMate wrote:
lurc wrote:
They just stop the command line and wait for user-input.

sync - Synchronize input buffer with source of characters
ignore - Extract and discard characters

(Taken from cplusplus)

Or he can use getchar; it does the same.


Why? He's using C++.

me to it works in c++ to.
Back to top
View user's profile Send private message
dEEznutz
Grandmaster Cheater
Reputation: 0

Joined: 29 Nov 2007
Posts: 514

PostPosted: Mon Aug 11, 2008 8:09 pm    Post subject: Reply with quote

Zand wrote:
Yes.

Put
Code:

std::cin.sync();
std::cin.ignore();


before return 0;

Uh, is there a different way for the CMD to not close by itself instead of using this?

_________________
Learning C++
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Mon Aug 11, 2008 8:10 pm    Post subject: Reply with quote

dEEznutz wrote:
Zand wrote:
Yes.

Put
Code:

std::cin.sync();
std::cin.ignore();


before return 0;

Uh, is there a different way for the CMD to not close by itself instead of using this?


Run the program from the command prompt
Back to top
View user's profile Send private message
dEEznutz
Grandmaster Cheater
Reputation: 0

Joined: 29 Nov 2007
Posts: 514

PostPosted: Mon Aug 11, 2008 8:14 pm    Post subject: Reply with quote

Yeah, how do I do that..?
_________________
Learning C++
Back to top
View user's profile Send private message
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Mon Aug 11, 2008 8:51 pm    Post subject: Reply with quote

Go to run -> cmd.
Code:

cd C:\dir\dir
hello


cd to where you have that program, then type "hello" assuming your program name is hello.exe.
Back to top
View user's profile Send private message
FullyAwesome
I post too much
Reputation: 0

Joined: 05 Apr 2007
Posts: 4438
Location: Land Down Under

PostPosted: Tue Aug 12, 2008 1:39 am    Post subject: Reply with quote

sorry for my post, i didn't mean to teach people bad things. that's why i said that it's just my opinion and it helped me out, but that might be because i didn't just learn vb.net. anyway sorry and don't listen to me in the future. Crying or Very sad
_________________
Back to top
View user's profile Send private message MSN Messenger
Noz3001
I'm a spammer
Reputation: 26

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

PostPosted: Tue Aug 12, 2008 2:29 am    Post subject: Reply with quote

TraxMate wrote:
noz3001 wrote:
TraxMate wrote:
lurc wrote:
They just stop the command line and wait for user-input.

sync - Synchronize input buffer with source of characters
ignore - Extract and discard characters

(Taken from cplusplus)

Or he can use getchar; it does the same.


Why? He's using C++.

me to it works in c++ to.


It's unnecessary shit.
Back to top
View user's profile Send private message MSN Messenger
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Tue Aug 12, 2008 4:02 am    Post subject: Reply with quote

dEEznutz wrote:
Uh, is there a different way for the CMD to not close by itself instead of using this?
It's a feature of Windows XP/Vista's cmd prompt. You could try finding an alternative (tweaked?) cmd prompt or switch to Win9x or something :P Also, there's a param called /K, which leaves the window open, in cmd. If you're using a shortcut to launch your program, you might want to add that one.

Btw.. Here's a great tool: http://www.microsoft.com/windowsxp/Downloads/powertoys/Xppowertoys.mspx -> "Open Command Window Here". Just right click on folder, click the Open CMD here and tada, there's a prompt for you in the right folder :)
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8588
Location: 127.0.0.1

PostPosted: Tue Aug 12, 2008 5:19 am    Post subject: Reply with quote

kitterz wrote:
dEEznutz wrote:

double edit: Hmm, I think it's working now because when I clicked start debugging it opened up a CMD and I got no errors. However, the cmd closed to fast for me to see anything. Is this what supposed to happen?


Or you can just use

Sleep ();


To pause a console, sleep would probably be the last thing someone should use. (Unless the programmer is specifically creating a timed pause before automatically closing.) Using sleep, as slovach stated, is a timed pause, this isn't an indefinate thing and using some huge number or something to force it paused is not good practice.

Theres no reason to not use the iostream example already given. And if it is a must, you can include conio.h and use _getch(); to yield a pause effect. But I recommend sticking with sync/ignore.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Tue Aug 12, 2008 11:51 am    Post subject: Reply with quote

Wiccaan wrote:
But I recommend sticking with sync/ignore.
I second that, but there's one thing above every other: don't pause the execution at all. Recently I came across with a lil' tool, the only negative thing in the tool was that it did wait for input at the end of program. God thank the source was available :)
Back to top
View user's profile Send private message
Jaak
Expert Cheater
Reputation: 0

Joined: 02 Jul 2008
Posts: 176

PostPosted: Wed Aug 13, 2008 6:22 am    Post subject: Reply with quote

rapion124 wrote:
Why does everyone use std::*? Why don't they just use printf()?


Better yet, why don't people do using namespace std; ? You see this big ass peace of code with std: : everywhere and it looks sloppy =O.
Back to top
View user's profile Send private message
Zand
Master Cheater
Reputation: 0

Joined: 21 Jul 2006
Posts: 424

PostPosted: Wed Aug 13, 2008 8:26 am    Post subject: Reply with quote

Because the std namespace is huge.
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, 4  Next
Page 3 of 4

 
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