Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include <time.h>
- #include <stdio.h>
- static char* extensionSearch(char * fileName){
- const char* extensions[] = {".exe", ".doc", ".xls", ".ppt", ".txt", ".jpg", ".eml", ".log"};
- char * fName = fileName;
- printf("%sn", *fileName);
- char* tmpRetValue = "";
- char* finalRetValue = "noExt";
- for(int i=0; i<sizeof(extensions)/sizeof(const char *); i ++)
- {
- tmpRetValue = strstr(fName, extensions[i]);
- if(strcmp(tmpRetValue, extensions[i]) == 0)
- {
- finalRetValue = extensions[i];
- }
- }
- return finalRetValue;
- }
- char* fileName = BytesToString(ff->name, ff->name_len);
- char* fileExt = extensionSearch(fileName);
Add Comment
Please, Sign In to add comment