Insert int into string
I'm trying to get this program working. Everything works fine but I can't figure out how to insert an int into a filename. The user inputs some stuff at the beginning of the program, one of those being a number, say 5. Then before the program ends it is suppose to write the file to something like
where # is the number they entered before, 5 in this case.
I can't get it to insert 5 into the filename, it just always writes it as run-.txt. Any suggestions?
sprintf( filename, "run-%d.txt", number );
fp = fopen( filename, "r" );