Computer Science Canada Java-Stdin.readInt (), Is there an equivilant to this in C? |
Author: | JMG [ Thu Sep 18, 2008 3:59 pm ] |
Post subject: | Java-Stdin.readInt (), Is there an equivilant to this in C? |
hey yall. I'm fairly familiar with Java but am currently trying to learn C. Is there a command in C similar to the Stdin.readInt() in java? I'm just basically trying to get user input and store it as a variable. Any help would be appreciated. |
Author: | OneOffDriveByPoster [ Thu Sep 18, 2008 5:50 pm ] |
Post subject: | Re: Java-Stdin.readInt (), Is there an equivilant to this in C? |
Do a web search on scanf(). |
Author: | md [ Thu Sep 18, 2008 10:17 pm ] |
Post subject: | RE:Java-Stdin.readInt (), Is there an equivilant to this in C? |
scanf is a horrible function, but it does work. Your best bet is to read in a string, then convert it into the format you want with strto* all of which return error codes for almost every error you might find. |
: |