Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #15368
| From | red floyd <no.spam.here@its.invalid> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Best Way to Handle Unknown Data Sizes? |
| Date | 2012-04-13 16:44 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <jmadpe$6uv$1@dont-email.me> (permalink) |
| References | <MPG.29f25082df0f84119896fd@news.eternal-september.org> <slrnjohau5.1ls.grahn+nntp@frailea.sa.invalid> |
On 4/13/2012 3:42 PM, Jorgen Grahn wrote:
> On Fri, 2012-04-13, 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));
>
> Something (apart from the function's design) is wrong here -- ASCII CR
> (not "C/R") is decimal 13. LF is 10.
>
> And if you mean C++ '\n', say '\n' instead of hardcoding a numeric
> value.
>
And if he really means CR, then he should use '\r'
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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