Re: removing newline character from the buffer read by fgets
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Tue, 28 Nov 2006 22:44:33 GMT
"junky_fellow@xxxxxxxxxxx" <junky_fellow@xxxxxxxxxxx> writes:
[...]
thanks everyone for your help. In fact, I don't want to use strlen()
or strchr() (for efficiency reasons) to remove the newline
character.
Why not? Is the call to strlen() or strchr() a performance bottleneck
in your program, justifying the extra work of writing an input
function from scratch?
It may be, but if you haven't measured it, you may be applying your
efforts unwisely. Typically reading the input from some external
device will be much slower than scanning a string in memory.
--
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.
.
- References:
- removing newline character from the buffer read by fgets
- From: junky_fellow@xxxxxxxxxxx
- Re: removing newline character from the buffer read by fgets
- From: Richard Heathfield
- Re: removing newline character from the buffer read by fgets
- From: junky_fellow@xxxxxxxxxxx
- removing newline character from the buffer read by fgets
- Prev by Date: Re: right prime numbers
- Next by Date: Re: screen clearing in ANSI C
- Previous by thread: Re: removing newline character from the buffer read by fgets
- Next by thread: Sharing static variables or function between source files.
- Index(es):
Relevant Pages
|