Re: stripping newline from input

From: John Smith (soneone_at_microsoft.com)
Date: 08/31/04


Date: Tue, 31 Aug 2004 13:11:44 +0100


"Ravi Uday" <raviuday@gmail.com> wrote in message
news:1093953853.274269@sj-nntpcache-5...
>
> "John Smith" <soneone@microsoft.com> wrote in message
> news:ch1oe6$jfd$1@newstree.wise.edt.ericsson.se...
> > Hi all
> >
> > Why doesn't this seem to work?
> >
> > void stripnl(char *sz)
> > {
> > char *nl;
> > nl = strchr(sz, '\n');
> > if (nl)
> > {
> > *nl = '\0';
> > }
> > }
> >
> > The string fed in still has the newline after calling this function.
>
> How do you know that ? There might be a '\r' (CR- if file is taken from
> windows) otherwise the function is fine.
>
>
>
> >
> > Thanks
> > John
> >
> >
>
>
Hey, that might be it! I'll remove '\r' also.

Thanks for the help

John



Relevant Pages

  • Re: one touch strips
    ... Hey, I once got a computer to work just by calling a friend & *leaving a ... John ...
    (alt.support.diabetes)
  • Re: stripping newline from input
    ... >> The string fed in still has the newline after calling this function. ... > windows) otherwise the function is fine. ... John ...
    (comp.lang.c)
  • Re: Ray Davies on Macca
    ... He's not an inuitive genius like John: much too controlled and self-conscious perhaps. ... But I have no problem at all in calling the man who changed the face of popular music a great intelligence. ... I may be jaded my insideness but I contend the profit motive, safe and 'repeat what is proven' aren't the best triad. ... small compared to the top few stations in a market of 40 years ago. ...
    (rec.music.beatles)
  • Re: diode curve
    ... >>> John ... >>Shit like what comes up with that is given control of your pension minus ... > Some guy keeps calling me offering to provide "integrated enterprise ... you should check the relevant database and update ...
    (sci.electronics.design)
  • Re: diode curve
    ... >>> John ... >>Shit like what comes up with that is given control of your pension minus ... > Some guy keeps calling me offering to provide "integrated enterprise ... you should check the relevant database and update ...
    (sci.electronics.design)