[Techtalk] C programming: question on fopen() parameters

Berenice Chong showercurtain2000 at yahoo.com
Wed Oct 8 04:49:07 EST 2003


I'm writing a test CGI script in C that writes form information into
a file. There needs to be a file for every form submitted.  My
problem is using fopen to open a file in another directory.  The file
name is the script process ID and if I do this, the file gets created
in the current directory:

<snip>
char filename[6];
sprintf(filename,"%d",(int)getpid()); 
filepointer=fopen(filename,"w");	
<snip>

What's the correct way to write the first parameter in fopen(), so
that the file appears in a different directory? 

thanks
Berenice 



__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com


More information about the Techtalk mailing list