You can use strxxx functions from string.h or use snprintf().
Eg.


char file_name[50];
/* don't forget to strip newline char in x if there's any */...