0

my dear friends, how to create multiple files(.txt) with different names(same folder) for read and write using c language.

This is my test case code, I just wanna try how the output will be seen...

14th Apr 2020, 3:47 PM
Prashanth
Prashanth - avatar
5 Réponses
0
using w+ should do
14th Apr 2020, 3:52 PM
Enrique Flores
Enrique Flores - avatar
0
Thanks, but how can i create multiple files using for loop
14th Apr 2020, 3:55 PM
Prashanth
Prashanth - avatar
0
you would have to do some research but i know its possible
14th Apr 2020, 3:56 PM
Enrique Flores
Enrique Flores - avatar
0
i think it was using sprintf or something like that
14th Apr 2020, 3:56 PM
Enrique Flores
Enrique Flores - avatar
0
FILE *files[50]; for (int i = 0; i < 50; i++) { char filename[20]; sprintf(filename, "results%d.dat", i); files[i] = fopen(filename, "w"); } I want to create files with in one folder how can i Like: new folder/newfile.txt, newfile2.txt, newfie3.txt........
14th Apr 2020, 4:02 PM
Prashanth
Prashanth - avatar