TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Jonathan de Boyne Pollar
from: Neil Heller
date: 2003-03-22 11:17:00
subject: switch statement

NH> atoi() IS standard and is included in stdlib.
NH> atoi   is NOT standard and could be anything.
NH> atoi() is equivalent to:  (int)strtol(s, (char ***)NULL, 10)
NH> atoi() can easily be replaced by the usage of sprintf() [...]

Jd> 2s/atoi/itoa/
Jd> 4s/atoi/itoa/

Jd> The statement in line 3 is not completely true (Consider 
Jd> what is defined to happen to "errno".).  The statement in 
Jd> (the corrected) line 4 is not completely true (Consider the 
Jd> use of itoa() to generate base 36 strings.).

Base 36?  I've never seen or heard of base 36 being used outside of an 
academic exercise.  Have you?  What's the necessity of this base?

Base 32, however, can be used as:

/*
  Test of sprintf()
*/

#include 

int main(void)
{
 char TargetStr[20];
 long Source = 331;

 sprintf(TargetStr, "0x%x", Source);

 return 0;
}

þ CMPQwk 1.42 999

--- Maximus/2 3.01
* Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000)
SEEN-BY: 633/267 270
@PATH: 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.