0

[HELP]How can I create lists with variable INT in the name using fopen() ?

https://code.sololearn.com/c1a8xDG647Kv/?ref=app

30th Sep 2019, 9:18 PM
Zakariae Moujhir
Zakariae Moujhir - avatar
3 ответов
0
please try the following: #include <stdio.h> #define FILE_NAME "list%d.txt" int main() { FILE *fpt; int i; char buf[255]; for(i=0;i<10;i++){ sprintf(buf, FILE_NAME, i); fpt = fopen(buf, "w"); } return 0; }
1st Oct 2019, 5:12 AM
Natanel Ziv
Natanel Ziv - avatar
0
Thank you, I have tried it, but it's not worked, warning '' the source file has not been compiled yet ''
2nd Oct 2019, 8:26 PM
Zakariae Moujhir
Zakariae Moujhir - avatar
0
Maybe your path is not full. Try entering the full path under the define
3rd Oct 2019, 3:38 AM
Natanel Ziv
Natanel Ziv - avatar