[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: int to string?
try this
char file[100];
int pid = getpid();
FILE * fileptr;
sprintf(file,"%s%d",argv[1],pid);
/*
this is assuming that argv[1] has the program name(command line param)
pid = pid od proc.
file is the string holding final file to be created.
now U can do something like this
*/
fileptr = fopen(file,"w");
/* go on */
hope it is good enuff.
bharat
On Wed, 05 Jul 2000 10:33:16 IST,
linux-india-programmers@xxxxxxxxxxxxxxxxxxxxx wrote:
> See atoi()
>
> or
>
> int mypid;
> char mypidstr[6];
> mypid = getpid();
> sprintf(mypidstr, "%d", mypid); /* Output go to string */
> puts(mypidstr);
>
>
> -T. Muthu Mohan.
> ________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
>
>
> -----------------------------------------------------------------------
> The LIP mailing list archives are available at:
> http://lists.linux-india.org/cgi-bin/wilma/linux-india-programmers
_______________________________________________________
Say Bye to Slow Internet!
http://www.home.com/xinbox/signup.html