Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Java-Stdin.readInt (), Is there an equivilant to this in C?
Index -> Programming, C -> C Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
JMG




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
OneOffDriveByPoster




PostPosted: 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().
md




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, C -> C Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: