#include #include #include #include #include #include #include #include char filename[300]; char str[300]; char *random_str(int len) { int i; for (i = 0; i < len; i++) { str[i] = 0x61 + (random() % 26); } str[i] = '\0'; return str; } int main(int argc, const char **argv) { int i, count; if (argc != 3) { fprintf(stderr, "Usage: %s \n", argv[0]); return 1; } count = atoi(argv[1]); srandom(atoi(argv[2])); strcpy(filename, "file."); for (i = 0; i < count; i++) { int fd; strcpy(&filename[5], random_str((i % 200) + 1)); fd = open(filename, O_CREAT|O_EXCL, 0666); close(fd); } return 0; }