fork download
  1. #include <iostream>
  2. #include <cstdio>
  3.  
  4. using namespace std;
  5.  
  6. #define TAM 4
  7.  
  8. int main()
  9. {
  10. for(int i = 1; i < TAM; i++) {
  11. char nome[FILENAME_MAX];
  12. snprintf( nome, FILENAME_MAX, "Data-%d.txt", i);
  13. cout << nome << endl;
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
Data-1.txt
Data-2.txt
Data-3.txt