c - Input int to file direction -


I am trying to get an int in the file URL in C programming.

  write = FOPAN ("/ user / function" / desktop / data / data.TTIC "," w ");  

This is what is I was thinking but it does not work

  int i = 1; write = FOPAN ("/ user / function / desktop / data / data% i.txt", "w", i );  

you should:

  #define FILENAME_LENGTH 200 / * Make it as big as you want * / char filename [FILENAME_LENGTH]; Sprintf (file name, "/Users / Function / Discoction Write / FOPN (filename, "W");  

If you have a C99 or C ++ 11 compiler, you will see the Snprintf to sprintf . snprintf is a safe option to prevent buffer overflow.

  snprintf (File name, FILENAME_LENGTH, "/ User / Funkniia / Desktop / Data / Data".);  

Checkout A.


Comments