Re: equivalent of chomp in perl
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Fri, 03 Nov 2006 04:29:36 GMT
CBFalconer <cbfalconer@xxxxxxxxx> writes:
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;
}
That's a useful function, but it's doesn't bear any particular
resemblance to Perl's chomp function.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.
- Follow-Ups:
- Re: equivalent of chomp in perl
- From: CBFalconer
- Re: equivalent of chomp in perl
- References:
- equivalent of chomp in perl
- From: lnatz
- Re: equivalent of chomp in perl
- From: CBFalconer
- equivalent of chomp in perl
- Prev by Date: Re: Long Num speed
- Next by Date: Stairs program
- Previous by thread: Re: equivalent of chomp in perl
- Next by thread: Re: equivalent of chomp in perl
- Index(es):
Relevant Pages
|