How do I create a file with a user-supplied name in C++? [closed]
I want the user to be able to type some text and then the computer creates a file called what ever the text was. In C++. 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) 来源: https://stackoverflow.com/questions/3427052/how-do-i-create-a-file-with-a-user-supplied-name-in-c