if i understand the question correctly, you want to scan the user's input, and then create and open the file using the input you just scanned.

so the logic of your program should ask the user for the file name, check if the name entered is valid and can be used, open a file with this name and work with this file. so based on what name the user is going to enter, your program will create the file with a appropriate name.