how to turn a user input into a text file for example user inputs 100 and the program creates a text file named 100.txt?
I have tried to work it out but it still doesnt work properly.
i used
Since you've already gotten the input from stdin, you should be supplying the variable which contains the user input as an argument instead of stdin.
And since you read it in as a string, you'll want to change "%d" to "%s". Also beware of newlines in your string, which could thoroughly mess up your program.
well all i want to do is for the user to input a name or number and for the program to create a text file with that name. im not actually writing anything into the file, its just an empty .txt file with a name that hte user chose
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.