Article View: es.comp.os.linux.programacion
Article #12025Re: atoi asta los co.....
From: Xavier Montero
Date: Mon, 10 Sep 2001 22:33
Date: Mon, 10 Sep 2001 22:33
38 lines
2138 bytes
2138 bytes
> Yo cre�a que ambas devolvian
> un entero equivalente al tama�o de una cadena o el indice de la
> misma,
?� No s� de donde lo has sacado: Mi man dice esto:
"
int atoi(const char *nptr);
The atoi() function converts the initial portion of the
string pointed to by nptr to int
"
Es decir, _convierte_ la porci�n inicial de una cadena a entero,
no que devuelve la _longitud_ de la cadena.
En cambio, strlen
"
size_t strlen(const char *s);
The strlen() function calculates the length of the string
s, not including the terminating `\0' character.
"
s� que calcula la longitud o tama�o.
Por ejemplo, si tu cadena es "A la porra", atoi devolver�
cero (0). Pero si tu cadena es "3 pelos tiene mi barba", atoi
devolver� 3.
> pero esto no devuelve mas que 0 ?:((.
> GGGGGGracias. Saludos.
Ver los ejemplos.
--
Xavier Montero - Digital Sound Items, scp
Tel: 93 589 71 91 - Fax: 93 590 10 96 - Cell: 630 59 01 62
www.dsitelecom.com - xmontero@dsitelecom.com
Technical Details
Message-ID:
<3B9D3FA6.88835E88@dsitelecom.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!nntp.abs.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!opentransit.net!newsfeed.comtenidos.com!newsfeeder.wanadoo.es!news.antakira.com!not-for-mailReferences:
<3B9D1E2B.E93F13C2@teleline.es>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII X-Google-Thread: f86c8,7199466e0fea4eef X-Google-Attributes: gidf86c8,public X-Google-ArrivalTime: 2001-09-10 16:21:02 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!nntp.abs.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!opentransit.net!newsfeed.comtenidos.com!newsfeeder.wanadoo.es!news.antakira.com!not-for-mail From: Xavier Montero <xmontero@dsitelecom.com> Newsgroups: es.comp.os.linux.programacion Subject: Re: atoi asta los co..... Date: Tue, 11 Sep 2001 00:33:10 +0200 Organization: Digital Sound Items Lines: 38 Message-ID: <3B9D3FA6.88835E88@dsitelecom.com> References: <3B9D1E2B.E93F13C2@teleline.es> NNTP-Posting-Host: 212.25.147.135 Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.wanadoo.es 1000163853 21693 212.25.147.135 (10 Sep 2001 23:17:33 GMT) X-Complaints-To: usenet@wanadoo.es NNTP-Posting-Date: Mon, 10 Sep 2001 23:17:33 +0000 (UTC) X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en