home *** CD-ROM | disk | FTP | other *** search
- Path: t500.vol.it!news
- From: robiz@mbox.vol.it (Roberto Bizzarri)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Help with an easy C issue.
- Date: 13 Jan 1996 22:14:07 GMT
- Organization: Video On Line
- Message-ID: <752.6586T1383T2827@mbox.vol.it>
- References: <737.6585T1284T2078@in.net>
- NNTP-Posting-Host: 194.166.59.133
- X-Newsreader: THOR 2.22 (Amiga;TCP/IP) *UNREGISTERED*
-
- On 13-Jan-96 03:30:59, John J. Maver, Jr. (mave@in.net) write to All:
- > This is going to be rediculously easy to solve. thanks in advance!!
-
- > I have a value entered as a string like,
-
- > char *mystring;
-
- This is wrong! You must declare a buffer:
- char mystring[100]; /* 100 bytes */
-
-
- > printf("Enter your age>");
- > scanf("%s",&mystring);
-
- > Now I want it to be an int, so:
- > myint=atoi(mystring);
- > I mess around with the int:
- > myint=myint+10;
- > And I want to turn myint back into a string.
- > HOW???
-
- sprintf(mystring, "%d", myint);
- NB: ^
-
- ...then look to "mystring"! ;-)
-
-
-
-
-
- __ __
- |_) |_)
- | \oberto |_)izzarri (E-mail: robiz@mbox.vol.it)
- (FidoNet: 2:332/901.31)
-
-