By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,912 Members | 1,911 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,912 IT Pros & Developers. It's quick & easy.

reading two lines from stdin using fgets

P: 11
i have the following code which works just fine:

printf("Enter a string: \n");
fgets(ch, 1024, stdin);

but i need it to read two lines. this quits as soon as i hit the enter key. how can i fix this up to allow two lines?
Sep 19 '06 #1
Share this Question
Share on Google+
1 Reply

P: 61
It couldn't be possible to take the two lines of input in a single string. So repeat the statements and use diiferent strings to store the input.
Sep 19 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.