scanf stop reading when eol is seen
Posted
by gcc
on Stack Overflow
See other posts from Stack Overflow
or by gcc
Published on 2010-06-05T18:26:01Z
Indexed on
2010/06/05
18:32 UTC
Read the original article
Hit count: 291
Filed under:
c
scanf("%[^\n]\n",A[i]);
/*that reads input line by line; example:first line is stored in A[0]*/
-> but I want read each element of line and send to struct fuction until
the EOL (end of line)
-> explaining: in current line,read one data ,then send to struct funcion
to hold,after then ,in for loop, read next data decide it is float
then send it to function.
when eol is read, then activate next struct.
>question is I want write something in scanf such that I stop read when
i see eol.
can I do
for( ; ; )
{ scanf("...",Sam);
if(Sam=='\n)
break;
}
© Stack Overflow or respective owner