C - Language User input to create text file
(I have Windows 7 and am using Visual studio Professional 2012)
I am a new C language student and am trying to write a program.
In the start of the program, I want the user input, his name, to be created as a txt file, with his name as the file name.( I will then save data there)
Is it possible to use the user input to create a file name?
I have looked at scanf, gets, fgets - but none seem to have this facility.
I have also googled this and cannot find any sort of answer.
Could anyone provide some advice as to where I should start looking.
Thanking you in anticipation.
PS I am not looking for code, just a pointer in the right direction if possible.
Yes. strcpy, strcat, sprintf. Take your pick or mix and match.
Look into fopen() and note the first parameter is the name of the file.
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
"I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
And realize that when you create the file, it will be in the program's current directory, which should probably be where the .EXE file is stored (I haven't played with file operations in recent versions of Visual Studio).
Oh, and if your course requires you to learn C99, then be advised that Visual Studio does not support it.
Thank you one and all.
This gives me a starting point.