int main(void) { srand((int)time(0)); int n = rand() % 1000000; //int ret = mkdir("n", 0777); if(ret < 0) { printf("...."); } printf("%d\n", n); return 0; }
int main(void) { srand((int)time(0)); int n = rand() % 1000000; //把数字转换成字符串 char buf[8]; bzero(buf, 8); sprintf(buf, "%d", n); int ret = mkdir(buf, 0777); if(ret < 0) { printf("...."); } printf("%d\n", n); return 0; }