cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/15/23:12:54

From: "Damian Yerrick" <die DOT spammers AT pineight DOT 8m DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Integer to String
Date: Sun, 15 Aug 1999 20:47:07 -0500
Organization: Rose-Hulman Institute of Technology
Lines: 44
Message-ID: <7p7qjs$af7$1@solomon.cs.rose-hulman.edu>
References: <199908142250 DOT SAA05391 AT delorie DOT com>
NNTP-Posting-Host: 137.112.204.250
X-Trace: solomon.cs.rose-hulman.edu 934768060 10727 137.112.204.250 (16 Aug 1999 01:47:40 GMT)
X-Complaints-To: news AT cs DOT rose-hulman DOT edu
NNTP-Posting-Date: 16 Aug 1999 01:47:40 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Dan Gold <TedMat AT CoastNet DOT com> wrote in message
news:199908142250 DOT SAA05391 AT delorie DOT com...
> itoa(),
> ex.
> itoa(integer, string, 10);
>
> Well thats how I do it and it works...=)
> from Dan Gold
> ----------
> > From: BuckTheMan <cvasser AT home DOT com>
> > To: djgpp AT delorie DOT com
> > Subject: Integer to String
> > Date: Saturday, August 14, 1999 6:59 AM
> >
> > How could I convert an integer to a string, I know atoi converts a
string
> to
> > an intger, but thats the opposite of what I need.
> >
> >


void sprintf(char *out, const char *format, ...)

/* Another way to do it is sprintf(), which lets you control the way the
number is formatted in the string. Look up printf() in your favorite C
reference for more info.

example: */

char strbuf[256];
int score;
sprintf(strbuf, "Score:%7d", score);

/* This would convert the integer to a string, right align it, and put
"Score" before it. Change the 'd' in the format string to an 'x' to use
hexadecimal. */

Damian Yerrick (comp DOT os DOT msdos DOT djgpp AT pineight DOT 8m DOT com)
Help defeat spam by tracing where they got their mail addresses. Get an
entire domain of e-mail addresses at http://www.freeservers.com


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019