Read the function documentation. They contain sections about the return values: fread | Microsoft Docs[^] _stricmp, _wcsicmp, _mbsicmp, _stricmp_l, _wcsicmp_l, _mbsicmp_l | Microsoft Docs[^] fread() returns the number of successfully read items which is the same as the third function parameter when reading was successful. So the while loop continues to be executed while reading is successful. stricmp() returns zero when the passed strings are identical. So the if block is executed when the passed strings are identical.