How do I create a file with a user-supplied name in C++? [closed]

眉间皱痕 提交于 2019-12-02 13:26:34
John Kugelman
#include <cstdlib>

int main() {
    return system("read FILE && touch \"$FILE\"");
}

Note: Requires POSIX. Should be OK, practically all modern OSes are POSIX-compatible.

Because this looks like homework, I'm not giving a complete example.

Look in:

  • #include <iostream> (Preferred) or
  • #include <cstdio> (Legacy)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!