🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: memcpy et char

#15509
From: Targeur fou
Date: Fri, 23 Sep 2005 20:28
49 lines
2268 bytes
Emmanuel Delahaye a écrit :

Salut,

> Targeur fou wrote on 23/09/05 :
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <string.h>
> > #include <ctype.h>
> >
> > int isCharValid(char c)
> > {
> >     return ( (isdigit(c) || c == '.' || c == ',') ? 1 : 0 );
>
> COmpliqué...

oui...

>
>      return (isdigit(c) || c == '.' || c == ',');
> > }
> >
> > /**
> >  * comma2dot
> >  * Remplace la virgule par le point comme séparateur dans une chaine
> > numérique
> >  * @param[in] s chaine à traiter
> >  * @return rc
> >  *  0 : succes
> >  *  -1 : argument nul
> >  *  -2 : pb allocation
> >  *  -3 : chaine fournie non valide
> >  */
> > int comma2dot(char * s)
> > {
> >     int rc = 0;
> >
> >     if (s != NULL) {
> >
> >         size_t lg = strlen(s);
> >         char * tmp = malloc(lg+1);
>
> Ca fout la trouille!

Quoi ça ? Le fait d'utiliser un malloc ? 

A+
Regis
Technical Details
Message-ID: <1127507318.886886.310360@f14g2000cwb.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mail
References: <4333e995$0$17469$626a14ce@news.free.fr> <1127484266.226712.264720@g49g2000cwa.googlegroups.com> <mn.bc267d590261c670.15512@YOURBRAnoos.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!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mail
From: "Targeur fou" <rtroadec@yahoo.fr>
Newsgroups: fr.comp.lang.c
Subject: Re: memcpy et char
Date: 23 Sep 2005 13:28:38 -0700
Organization: http://groups.google.com
Lines: 50
Message-ID: <1127507318.886886.310360@f14g2000cwb.googlegroups.com>
References: <4333e995$0$17469$626a14ce@news.free.fr>
   <1127484266.226712.264720@g49g2000cwa.googlegroups.com>
   <mn.bc267d590261c670.15512@YOURBRAnoos.fr>
NNTP-Posting-Host: 86.193.82.151
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1127507325 4761 127.0.0.1 (23 Sep 2005 20:28:45 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 23 Sep 2005 20:28:45 +0000 (UTC)
In-Reply-To: <mn.bc267d590261c670.15512@YOURBRAnoos.fr>
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: f14g2000cwb.googlegroups.com; posting-host=86.193.82.151;
   posting-account=fOMkYQwAAABKlO16y49Xa8i9lcFFGyi3