Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5.  
  6.  
  7.  
  8. bool ShowFile(char * FileName, char * Name)
  9. {
  10. FILE* file;
  11. if (fopen_s(&file, FileName, "rt") != 0) { return false; }
  12. while (!feof(file))
  13. {
  14. char AttName[100];
  15. int a = sscanf_s("Content-Disposition: attachment; filename=\"%[^\"]\"", AttName, _countof(AttName));
  16. Name = AttName;
  17. }
  18. fclose(file);
  19. return true;
  20. }
  21.  
  22.  
  23. int main(int argc, char* argv[])
  24. {
  25. char FileName[100];
  26. if (argc == 2) strcpy_s(FileName, _countof(FileName), argv[1]);
  27. else {
  28. printf("Source file name: "); gets_s(FileName, _countof(FileName));
  29. }
  30. char Name[100];
  31. ShowFile(FileName, Name);
  32. printf("%s \n", Name);
  33. system("pause");
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement