• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

reading lines from keyboard - simple

what condition do you have to specify in a loop which reads words
until the user enters blank?
 I am using scanf.
1 Solution

Just read until scanf returns zero or EOF.
You can do it in one statement only using scanf()

The function will read input until a '\n' is detected. Put any thing you want at the place of n like A,Q or blank character, '\x0' The string will be read until that char is encountered.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The IT Degree for Career Advancement

Earn your B.S. in Network Operations and Security and become a network and IT security expert. This WGU degree program curriculum was designed with tech-savvy, self-motivated students in mind – allowing you to use your technical expertise, to address real-world business problems.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now