From: jromano AT slate DOT Mines DOT EDU (Jean-Luc Romano) Newsgroups: comp.os.msdos.djgpp Subject: Re: integer to string Date: 8 Feb 1998 21:10:37 GMT Organization: Colorado School of Mines Lines: 29 Message-ID: <6bl70d$bou$1@herald.Mines.EDU> References: <34DE1449 DOT 185C AT bellsouth DOT net> NNTP-Posting-Host: slate.mines.edu To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk In article <34DE1449 DOT 185C AT bellsouth DOT net> you wrote: : Im tring to insert the num rturned by getpid(unix sytem call) into a : string. cna someone tell me how to do this if the : int is Mypid and the ptr to the string is *str. I think itoa() (the int to ascii function) should do the trick. You can try the following: str = itoa(Mypid); You may encounter a problem is Mypid is not a one digit integer. If this is the case, you will want to make sure *str is a char string and try this little nifty code left over from the original C language: sprintf(str, "%d", Mypid); The sprintf command is just like the printf command, but instead of printing the output to the screen (stdout), it prints it to a char string (in this case, str) for later use. (Also note that the sprintf function is useful for concatenating many variables of different types into one character string.) Hope this helps. Jean-Luc Romano