【问题标题】:How to create and open many files using c program ? (say n files)如何使用 c 程序创建和打开多个文件? (说n个文件)
【发布时间】:2015-09-10 04:27:12
【问题描述】:

我需要知道如何创建许多空文件并使用 c 程序同时打开它们。

【问题讨论】:

  • 阅读fopen并使用它。
  • 如果您知道如何使用 C 创建一个文件,那么您可以结合 for-loop 的概念来创建 n 个文件名具有更改后缀的文件,例如文件01,文件02,文件N ....
  • Need to know...很好。 (implicit) Did not try anything myself...不好。

标签: c file fopen ulimit


【解决方案1】:
FILE *fp[n];
for(i=0;i<n;i++)
{
  fp=fopen("filename","mode");

  /*Do What you want with these files....*/

  fclose(fp);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-05-12
    • 2020-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-15
    • 2010-11-21
    相关资源
    最近更新 更多