Guest User

Untitled

a guest
Jun 20th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #include <string.h>
  2. #include <time.h>
  3. #include <stdio.h>
  4. static char* extensionSearch(char * fileName){
  5. const char* extensions[] = {".exe", ".doc", ".xls", ".ppt", ".txt", ".jpg", ".eml", ".log"};
  6.  
  7. char * fName = fileName;
  8. printf("%sn", *fileName);
  9. char* tmpRetValue = "";
  10. char* finalRetValue = "noExt";
  11. for(int i=0; i<sizeof(extensions)/sizeof(const char *); i ++)
  12. {
  13. tmpRetValue = strstr(fName, extensions[i]);
  14. if(strcmp(tmpRetValue, extensions[i]) == 0)
  15. {
  16. finalRetValue = extensions[i];
  17. }
  18.  
  19.  
  20. }
  21. return finalRetValue;
  22. }
  23.  
  24. char* fileName = BytesToString(ff->name, ff->name_len);
  25. char* fileExt = extensionSearch(fileName);
Add Comment
Please, Sign In to add comment