I have this file that I'm making as a fun personal project that creates a bunch of files called yeet from a short choice of directories
the issue is somewhere between the directory array and the file opening so that's what I'll show here
the array looks like this
char patharrays[13][30] = {
"downloads/",
"documents/",
"videos/",
"pictures/",
"favorites/",
"music/",
"onedrive/",
"links/",
"contacts/",
"searches/",
"\"Saved Games\"/",
"../../\"Program Files\"/",
"../../\"Program Files (x86)\"/"
};
int randomPathNum = random_number(0, 13);
while the file creator loop looks like this ( y is a random number between 1 and 1000 )
for (int x = 1; x <= y; x++) {
FILE *yeetfile;
char filename[58];
sprintf(filename, "%%USERPROFILE%%/%syeet%i.txt", patharrays[randomPathNum], x);
yeetfile = fopen(filename, "w");
fputs("lol, imagine getting yeeted", yeetfile);
fclose(yeetfile);
}
I started doing C two days ago and I'm not quite sure on how to approach this, any help would be amazing.
Note: When using hard paths that use my actual profile name, instead of %USERPROFILE%, the code works and creates the files. It fails most likely due to my confusion with %