[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: more on smsreader

From: Bostjan Muller
Subject: Re: more on smsreader
Date: Sun, 14 Apr 2002 13:14:39 +0200
User-agent: Mutt/1.3.28i

* On 14-04-02 at 12:40 Nick Andrew (address@hidden) wrote:
+----Here quoted text begins----+
> Surely this should be "num_len - 1" because you want to copy one less
> byte than the length of the string.

yes it should be 

> Also, why does the "length > 10" test have to be in there? Surely if
> you want to remove the '+' sign, just test if the first char is a +
> and then remove it if so:

I thought that if I cut one char (the + sign) from the number if there
was more than 10 chars it would work... but it did not obviously. 

>       char    *p = message->RemoteNumber.number;
>       if (p->[0] == '+') {
>               p++;
>       }
>       strcpy(number, p);
> "strncpy" in your code gains nothing because the required data to copy
> is always the source string until NUL. Introduction of the temporary
> variable 'p' simplifies the arguments to strcpy and makes the intent
> of the code more obvious: to copy everything except an optional leading
> '+'.

Ok that would be a nicer way to do it (I must admit I am a lousy coder,
and my C skills are the ones of a beginner).

+----and here the quote ends----+

Still the problem remains... the original code:
still returns one number short - the last number is ALLWAYS missing if
number is longer than 10 characters, and that is what I need fixed.
Does anyone know how to fix that?

Regards/Lep pozdrav

Boštjan Müller
[*] Boštjan Müller - address@hidden - [*]
[*]    GPG/PGP key -> finger: address@hidden, DSA id: 0x9B2FF108    [*]
[*] Celular: +386(0)41243189, Powered by Debian GNU/LiNUX - ICQ #:7506644  [*]
                       There's no place like ~

reply via email to

[Prev in Thread] Current Thread [Next in Thread]