Basically, I am trying to list e-mails from a file and give them an assigned integer value like 1, 2, 3, 4, etc...
And then I ask the user, which e-mail do you want to open? If they input 4, I open the 4th email.
But all I know of to work with is getchar() which will only get characters for me. I need it to be an integer because if they put 4 in, I need to compare that integer value to a counter to see if I've reached the e-mail they desire.
For example, if the fourth e-mail is 4. SUBJECT: HI
and the user inputs 4 to read that e-mail, I need to loop back through the entire mailbox until I reach the fourth e-mail.
Thanks for the help in advance
In C, how can I get an integer from the standard command line input?
in c, get a line of text from the user with gets_s(), or older gets() if your compiler is old. Once you have the user string, convert it to integer with atoi()
Reply:int c;
c = getchar();
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment