sprintf function

Hi,
Can someone help me to figure out whether this code is to write file to /tmp/TIMECLOCK directory or just to asign a variable with "/tmp/TIMECLOCK/name.log_copy.pid" as the string?

I am looking into an old C program and could not figure out where in the code that creates /tmp/TIMECLOCK/name.log_copy.pid file except here.

But I thought sprintf only assignes value to string....

==========
sprintf( szfilename, "/tmp/TIMECLOCK/%s.log_copy.%d", n
ame, pid );

Thanks!

You are right. From the man page of sprintf:

int sprintf(char *s, const char *format, /* [arg,] */ ...);

sprintf() places ``output'', followed by the null character (\0), in
      consecutive bytes starting at *s.  It is the user's responsibility to
      ensure that enough storage is available.

What this code is doing is that it is setting up the string szfilename with "/tmp/TIMECLOCK/<somename>.log_copy.<processid>". The program might use the variable later to open a (possibly) unique file or something.