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 


[Request] Help on C++
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Cx
Master Cheater
Reputation: 0

Joined: 27 Jul 2007
Posts: 367

PostPosted: Tue Jan 22, 2008 8:39 pm    Post subject: Reply with quote

What's the difference between cin.sync and cin.get.
I'm too lazy to look it up, and besides you can probably give a better explanation.
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 Jan 22, 2008 8:47 pm    Post subject: Reply with quote

Cx wrote:
What's the difference between cin.sync and cin.get.
I'm too lazy to look it up, and besides you can probably give a better explanation.


They aren't really something to be compared, they do two different things.

sync:
http://www.cplusplus.com/reference/iostream/istream/sync.html

Quote:
Synchronizes the buffer associated with the stream to its controlled input sequence. This effectively means that the unread characters in the buffer are discarded.


get:
http://www.cplusplus.com/reference/iostream/istream/get.html

Quote:
Extracts a character from the stream and returns its value (casted to an integer).


ignore:
http://www.cplusplus.com/reference/iostream/istream/ignore.html

Quote:
Extracts characters from the input sequence and discards them.




When you use get(), you are only pulling the first character of the inputted string. Which leaves the rest of the buffer in memory. When you use ignore/sync you are clearing the buffer and keeping it updated and clear freeing the memory before returning.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
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
Page 2 of 2

 
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