On Sun, 06 Aug 2006 10:29:47 -0700
Carl William Spitzer IV
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. Your program would also run under dosemu. -- Jerry Feldman
Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9