|
| iMatix home page | << | < | > | >> |
SFLVersion 2.11 |
#include "sflfile.h"
char *
get_new_filename (
const char *filename)
Appends a numeric suffix (_001, _002,...) to the filename until it is unique. Returns a freshly-allocated string containing the new filename.
{
char
suffix [8],
*new_name;
int
counter;
for (counter = 0; ; counter++)
{
sprintf (suffix, "_%03d", counter);
new_name = xstrcpy (NULL, filename, suffix, NULL);
if (!file exists (new_name))
return (new_name);
else
mem_free (new_name);
}
return (NULL);
}
| | << | < | > | >> |
|