fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  5. char asistan[][3] = {"AB", "AA", "CS", "DS"};
  6. const char* foldername = "c:\\deneme\\";
  7. int main(int argc, char *argv[]) {
  8.  
  9. int i = 0;
  10. int count = 4;
  11. for (; i< count ; ++i)
  12. {
  13. char * filename = (char *)calloc(255, sizeof(char));
  14.  
  15. if(filename == NULL)
  16. {
  17. exit(-1);
  18. }
  19. if(sprintf(filename, "%s%s%d%s", foldername, asistan[i], i, ".csv") <0)
  20. {
  21. exit(-1);
  22. }
  23. printf("%s\r\n", filename);
  24. free(filename);
  25. filename = NULL;
  26. }
  27. return 0;
  28. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
c:\deneme\AB0.csv
c:\deneme\AA1.csv
c:\deneme\CS2.csv
c:\deneme\DS3.csv