home *** CD-ROM | disk | FTP | other *** search
- Path: shell1.eznet.net!not-for-mail
- From: armstron@eznet.net (Jon Armstrong)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: C prog problem
- Date: 2 Jan 1996 03:34:56 -0500
- Organization: E-Znet, Incorporated, Rochester, NY 14604 (716)-262-2485
- Message-ID: <4caqng$o9e@shell1.eznet.net>
- References: <5326.6569T1305T1672@infi.net> <805.6571T1295T2945@mbox3.swipnet.se>
- NNTP-Posting-Host: shell1.eznet.net
-
- In article <805.6571T1295T2945@mbox3.swipnet.se>,
- Roland Bengtsson <roland.bengtsson@mbox3.swipnet.se> wrote:
-
- > >:This command only supports charecters .Is there a integer to char function ?
- > >:A better way to display text to the screen?
- >
- >If you have SAS/C you have this function:
- >
- > stci_d() - Convert an integer to a decimal string
-
- Actually sprintf() might be a better (more portable) solution.
-
- The following is only an example and is uncompiled/untested:
-
- void func(char *s, int i)
- {
- if(s)
- {
- sprintf(s,"%d",i);
- }
- }
-
- int main()
- {
- char s0[100];
-
- s[0] = '\0';
- func(&s0[0],5);
- printf("[%s]\n",s0);
- return 0;
- }
-
- --
- +----------------------------------------------+
- Regards... Jon | Armstrong | LPA Software, Inc. | jma@lpa.com |
- +----------------------------------------------+
-