在C中,我想创建并打开文本文件来写入数据,但问题是我想要随时命名文件,如
FILE *ptr;
for(i=0;i<1000;i++){
fopen_s(&ptr,"i.txt","w");
operations to fill data into file i.txt;
fclose(ptr);
}
Run Code Online (Sandbox Code Playgroud)
这样我将创建文件0.txt,1.txt,2.txt ... 999.txt.
这怎么可能?我检查了打开并重命名功能,但找不到办法.
非常感谢您的帮助.最好,