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 


Questions with C Programming

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
tanjiajun_34
Grandmaster Cheater
Reputation: 0

Joined: 16 Feb 2006
Posts: 786
Location: Singapore

PostPosted: Tue Nov 23, 2010 6:04 am    Post subject: Questions with C Programming Reply with quote

Question 1
How to I detect if the inputted value using scanf is out of range (More than 2147483647 or less than -2147483648) for a Int32.

Question 2
How to make like a type writer effect like 1 char by 1 char appearing for printf?

Question 3
How to make scanf not stop at a space for char string. Like when I input

abc def

It only capture abc not def.
Back to top
View user's profile Send private message
AtheistCrusader
Grandmaster Cheater
Reputation: 6

Joined: 23 Sep 2006
Posts: 681

PostPosted: Tue Nov 23, 2010 7:05 am    Post subject: Re: Questions with C Programming Reply with quote

tanjiajun_34 wrote:

Question 3
How to make scanf not stop at a space for char string. Like when I input

abc def

It only capture abc not def.


std::cin.getline()
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Tue Nov 23, 2010 9:06 am    Post subject: This post has 1 review(s) Reply with quote

1. Try reading the number as a string and converting it to a decimal number instead, check out "strtol".

2. Create a loop and print one char at a time from the string you want to output, and use a small wait between each print.

3. Check out fgets instead:
http://www.cplusplus.com/reference/clibrary/cstdio/fgets/

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

Joined: 16 Feb 2006
Posts: 786
Location: Singapore

PostPosted: Tue Nov 23, 2010 9:17 am    Post subject: Reply with quote

Ok. Thanlks you both of you. My fourth question is how to like set a limit of chars to a scanf?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Tue Nov 23, 2010 9:31 am    Post subject: Reply with quote

tanjiajun_34 wrote:
Ok. Thanlks you both of you. My fourth question is how to like set a limit of chars to a scanf?


Set it with a number after the % formatter. For example:

Code:
scanf( "%25s", container );


http://www.cplusplus.com/reference/clibrary/cstdio/scanf/

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

Joined: 16 Feb 2006
Posts: 786
Location: Singapore

PostPosted: Tue Nov 23, 2010 9:46 am    Post subject: Reply with quote

Thansk again. Some more questions......
Question 5
How to make a conversion specifier in a conversion specifier. Like I 1 2 be able to set the number of decimal place displayed in runtime. I 1 2 make it like %.%df.


Question 6
How to make a char type display in CAPS letter. Meaning like a becomes A.

Question 7
fflush(stdin);
I read it means flush away input stream buffer. Is it because stdin.h contains all the printf and scanf. Thats why by flushing away it clears all the data involving stdin?

Question 8
fgets vs gets?
What is the differences?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Tue Nov 23, 2010 10:47 am    Post subject: Reply with quote

If you are going to continue asking questions like this, maybe you should take some time to start reading some books or other material about the language. You are asking some pretty basic questions that go with each of the functions you are using.

Rather then us hand you every answer and you not really learn anything from it, I'd suggest you start reading some before asking questions.

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

Joined: 23 Sep 2006
Posts: 681

PostPosted: Tue Nov 23, 2010 11:19 am    Post subject: Reply with quote

Question 6
How to make a char type display in CAPS letter. Meaning like a becomes A.

ASCII 65 = A
ASCII 97 = a
ascii code - 32 = capital
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
Page 1 of 1

 
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