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
views:
61answers:
2
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
2010-06-04 17:53:17
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
2010-06-04 18:13:41