🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fr.comp.lang.c
Article #15501

Re: memcpy et char

#15501
From: Harpo
Date: Fri, 23 Sep 2005 16:51
50 lines
1928 bytes
Alain CROS wrote:

> Bonjour.
> 
> Merci pour les nombreuses r�ponses.
> J'analyse tous �a pour essayer d'en tirer de bonnes pratiques.
> 
> Alain CROS

Regarde aussi cette version :

#include <string.h>
#include <ctype.h>

#define INVALID_STRING -1
int 
str_to_numstr( int taille, char * str )
{
    int i ;
    char * pStr = str ;
    int point_posit = 0 ;
    int rc = 0 ;

    for( i = 0 ; i++ < taille ; pStr++ )
    {
        int c = * pStr ;
        if ( ! isdigit( c ) ) 
        {
            if ( c == ',' )
            {
                // on retourne INVALID STRING s'il y a plusieurs ','
                if ( point_posit )
                {
                    return( INVALID_STRING ) ;
                }
                point_posit = i ;
            }
            else
            {
                return( INVALID_STRING ) ;
            }
        }
    }
    if ( point_posit )
    {
        *( str + point_posit - 1 ) = '.' ;
        rc = point_posit ;
    }
    return( rc ) ;
}
Technical Details
Message-ID: <43343298$0$1729$8fcfb975@news.wanadoo.fr>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!freenix!news.wanadoo.fr!news.wanadoo.fr!not-for-mail
References: <4333e995$0$17469$626a14ce@news.free.fr> <43341a89$0$18839$626a14ce@news.free.fr>

Show Full Headers
Complete Article Headers
X-Google-Thread: f9822,366ad66ae342f8da
X-Google-Attributes: gidf9822,public
X-Google-Language: FRENCH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!freenix!news.wanadoo.fr!news.wanadoo.fr!not-for-mail
Message-ID: <43343298$0$1729$8fcfb975@news.wanadoo.fr>
From: Harpo <trashcan@hotmail.com>
Subject: Re: memcpy et char
Newsgroups: fr.comp.lang.c
Date: Fri, 23 Sep 2005 18:51:03 +0200
References: <4333e995$0$17469$626a14ce@news.free.fr> <43341a89$0$18839$626a14ce@news.free.fr>
Organization: ARG ; Association pour la Rehabilitation du Goto
User-Agent: KNode/0.8.2
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8Bit
Lines: 52
NNTP-Posting-Date: 23 Sep 2005 18:51:36 CEST
NNTP-Posting-Host: 81.53.255.96
X-Trace: 1127494296 news.wanadoo.fr 1729 81.53.255.96:46809
X-Complaints-To: abuse@wanadoo.fr