471,092 Members | 1,029 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,092 software developers and data experts.

reading two lines from stdin using fgets

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
1 8750
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.

Similar topics

20 posts views Thread by sahukar praveen | last post: by
6 posts views Thread by Charlie Zender | last post: by
6 posts views Thread by KevinD | last post: by
40 posts views Thread by googler | last post: by
19 posts views Thread by mailursubbu | last post: by
12 posts views Thread by rajash | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.