Hi!
This is a snippet from my code and what am I trying to do is that the file the program reads from some selected directory extends it's length to 12 in that way that adds spaces at the end of the filename.
Example:
"level.lvl"
"level.lvl..."
Note: . is space
The problem is that not all files get extended (especially the ones that has shorter filename than the file before). WHY, I don't know, so please help me.
Code:
short SearchFileLoop = 1, MatchFound = 0;
struct _finddata_t File = {0};
intptr_t Search = 0, FoundedFiles = 0;
.
.
.
if ((FoundedFiles = _findfirst ("./DATA/", &File)) != -1)
{
while (SearchFileLoop)
{
for (i = 0; i < 12; i++)
{
if (File.name[i] == '\0') File.name[i] = ' ';
}
// matching file founded
if (strcmpi ("level.lvl ", File.name) == 0) MatchFound = 1;
Search = _findnext (FoundedFiles, &File);
if (Search == -1) SearchFileLoop = 0;
}
}
.
.
.