I want to open a file in fortran with file name "controlinputs.12.dat" and then write into that file. The digit "12" is user defined variable whose value is stored in another variable "k". I have tried following and failed.
k=12
open(10,filename='controlinputs.',k,'.dat')
Tried storing the name in character and then using character to open file.
k=12
fname='controlinputs.',k,'.dat'
open(10,filaname=fname)