tags:

views:

61

answers:

2

line by line, there are inputs.
first line will be stored in as[0]
second one is as[1]
...
how input line ends is not known (maybe it end with EOF or new line character)
how should I take input

A: 

Are those the only 2 ways the inputs could end? If so, just check for both. I think you need to define the requirements of your interface more clearly.

Andy_Vulhop
A: 

You can use fgets as it will stop at either the newline or EOF.

From the Opengroup man page:

The fgets() function shall read bytes ... until n-1 bytes are read, or a is read ... or an end-of-file condition is encountered

Note that if fgets finds a newline, it will be saved in your buffer.

R Samuel Klatchko