
-----------------------------------
JMG
Thu Sep 18, 2008 3:59 pm

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.

-----------------------------------
OneOffDriveByPoster
Thu Sep 18, 2008 5:50 pm

Re: Java-Stdin.readInt (), Is there an equivilant to this in C?
-----------------------------------
Do a web search on scanf().

-----------------------------------
md
Thu Sep 18, 2008 10:17 pm

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.
