-
-
Save Yakkie/831ee9f0643413c70bcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string allowed_extensions[5] = {".gif", ".jpg", ".png", ".bmp", ".pbb"}; | |
bool checkImage(string file){ | |
string extension = getExtension(file); | |
for(int i = 0 ; i < 5 ; i ++ ) | |
if(allowed_extensions[i] == extension) | |
return true; | |
return false; | |
} | |
string getExtension(string file){ | |
int loc = file.find_last_of('.'); | |
if(loc > -1){ | |
return file.substr(loc); | |
} | |
return ""; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment