Re: equivalent of chomp in perl



lnatz wrote:

Is there an equivalent to the perl command chomp in C? And if
there is no exact equivalent command, how would I go about
removing the "\n" at the end of a stdin?

int flushln(FILE *f) {
int ch;

while (('\n' != (ch = getc(f))) && (EOF != ch)) continue;
return ch;
}

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>


.



Relevant Pages

  • equivalent of chomp in perl
    ... Is there an equivalent to the perl command chomp in C? ... no exact equivalent command, how would I go about removing the "\n" at ... the end of a stdin? ...
    (comp.lang.c)
  • equivalent of chomp from perl in C
    ... Is there an equivalent to the perl command chomp in C? ... no exact equivalent command, how would I go about removing the "\n" at ...
    (comp.lang.misc)