On Sun, 2006-08-06 at 08:39 -0400, Jerry Feldman wrote:
I just want to add that using date and time today on fast multi-tasking systems will not give you the uniqueness you need. The mkstemp(3) function will give you a guaranteed unique name.
Note that in my quick and dirty example, I did not add the file extension. If you do need to add the extension, do it after the mkstemp() call since the XXXXXX template must be the last 6 characters. You can easily do this: char *ext; ext = strrchr(OldName, '.'); : /* after mkstemp but before rename */ if (ext != NULL) strcat(NewNanme, ext);
On a fast system I would simply adapt to find of the newname exists and loop back to make a new one. Strangely enough running the old exe works if I use it with wine in a loop so at the binary level there is some function. wine uniquena.exe $i This may be fun after all. -- ___ _ _ _ ____ _ _ _ | | | | [__ | | | |___ |_|_| ___] | \/