I have been trying to read all of the directories and files within a specified directory. This directory only contains subdirectories. They have names of F00 all the way to F49. I kept getting an error when it got to F12 so I decided to check it out. When I decided to printf all of the f.cFileNames's to the console, F12 contained incorrect characters. Here is the output from the command line:
Here is the code used to do it:Code:C:\Ben\F00\* - 12 C:\Ben\F01\* - 12 C:\Ben\F02\* - 12 C:\Ben\F03\* - 12 C:\Ben\F04\* - 12 C:\Ben\F05\* - 12 C:\Ben\F06\* - 12 C:\Ben\F07\* - 12 C:\Ben\F08\* - 12 C:\Ben\F09\* - 12 C:\Ben\F10\* - 12 C:\Ben\F11\* - 12 C:\Ben\↑{▼\* - 12 C:\Ben\F13\* - 12 C:\Ben\F14\* - 12 C:\Ben\F15\* - 12 C:\Ben\F16\* - 12 C:\Ben\F17\* - 12 C:\Ben\F18\* - 12 C:\Ben\F19\* - 12 C:\Ben\F20\* - 12 C:\Ben\F21\* - 12 C:\Ben\F22\* - 12 C:\Ben\F23\* - 12 C:\Ben\F24\* - 12 C:\Ben\F25\* - 12 C:\Ben\F26\* - 12 C:\Ben\F27\* - 12 C:\Ben\F28\* - 12 C:\Ben\F29\* - 12 C:\Ben\F30\* - 12 C:\Ben\F31\* - 12 C:\Ben\F32\* - 12 C:\Ben\F33\* - 12 C:\Ben\F34\* - 12 C:\Ben\F35\* - 12 C:\Ben\F36\* - 12 C:\Ben\F37\* - 12 C:\Ben\F38\* - 12 C:\Ben\F39\* - 12 C:\Ben\F40\* - 12 C:\Ben\F41\* - 12 C:\Ben\F42\* - 12 C:\Ben\F43\* - 12 C:\Ben\F44\* - 12 C:\Ben\F45\* - 12 C:\Ben\F46\* - 12 C:\Ben\F47\* - 12 C:\Ben\F48\* - 12 C:\Ben\F49\* - 12
So, what the hell?! I checked all of the settings of F12 against all of the other folders and they were identical.Code:if (strncmp(f.cFileName, "..", 2) > 0) { j++; directories[j] = (char *)calloc((strlen(base) + strlen(f.cFileName) - 1), sizeof(char)); strncat(directories[j], base, strlen(base) - 1); strcat(directories[j], f.cFileName); strcat(directories[j], "\\*"); printf("%s - %d\n", directories[j], strlen(directories[j])); }