Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #15361

Re: Best Way to Handle Unknown Data Sizes?

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: Best Way to Handle Unknown Data Sizes?
Date 2012-04-14 10:21 +1200
Message-ID <9urn6nFjbhU3@mid.individual.net> (permalink)
References <MPG.29f25082df0f84119896fd@news.eternal-september.org>

Show all headers | View raw


On 04/14/12 10:03 AM, Mike Copeland wrote:
>     I have a number of functions similar to the code below that are
> starting to cause problems when incoming data exceeds the limit (e.g.
> 1024) imposed by the code.  Rather than select another arbitrary limit
> and have the problem occur later when larger data appears, I'd like to
> fix the issue the right way.  I'm unsure how to do this...
>     Please advise.  TIA
>
> char* TextFunctions::removeCR(char *s) // Remove C/R from data string
> {
>      static char w[1024];
>      int         n;
>      char        *p;
>
>      strcpy (w, s);
>      n = strlen(w);
>      p = strrchr(w, char(10));
>      if(p) w[p-w] = '\0';
>
>      return w;
> }  // remove CR

Use C++ strings.

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Best  Way to Handle Unknown Data Sizes? mrc2323@cox.net (Mike Copeland) - 2012-04-13 15:03 -0700
  Re: Best  Way to Handle Unknown Data Sizes? Ian Collins <ian-news@hotmail.com> - 2012-04-14 10:21 +1200
  Re: Best  Way to Handle Unknown Data Sizes? copx <copx@gazeta.pl> - 2012-04-14 00:38 +0200
  Re: Best  Way to Handle Unknown Data Sizes? Paavo Helde <myfirstname@osa.pri.ee> - 2012-04-13 17:39 -0500
  Re: Best  Way to Handle Unknown Data Sizes? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-04-13 22:42 +0000
    Re: Best  Way to Handle Unknown Data Sizes? red floyd <no.spam.here@its.invalid> - 2012-04-13 16:44 -0700
  Best Way to Handle Unknown Data Sizes?  @Jeff-Relf.Me - 2012-04-13 16:04 -0700
    Best Way to Handle Unknown Data Sizes?  @Jeff-Relf.Me - 2012-04-13 17:16 -0700
      Re: Best Way to Handle Unknown Data Sizes?  Ian Collins <ian-news@hotmail.com> - 2012-04-14 12:20 +1200

csiph-web