// Open the file for reading
fleCredentials = fopen("credentials.crd", "r");
// Scan the file from beginning to end
while( !feof(fleCredentials) )
{
// Read a username
fscanf(fleCredentials, "%s", UsernameFromFile);
// Compare the typed username with the username from the file
if( strcmp((LPCTSTR)m_Username, UsernameFromFile) == 0 )
{
// With the current username, retrieve the corresponding password
fscanf(fleCredentials, "%s", PasswordFromFile);
// Compare the typed password with the one on file
if( strcmp((LPCTSTR)m_Password, PasswordFromFile) == 0 )
{
ValidLogin = true;
}
else
ValidLogin = false;
}