home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / win_lrn / i_o / gtempdrv.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-11  |  1.3 KB  |  43 lines

  1. /*
  2.  *
  3.  * GetTempDrive
  4.  *
  5.  *  This program demonstrates the use of the GetTempDrive function
  6.  *  by returning the drive letter of the drive which can provide the
  7.  *  best access time during disk operations involving a temporary file.
  8.  *
  9.  */
  10.  
  11. #include "windows.h"
  12.  
  13. /* WINMAIN */
  14. int PASCAL WinMain (hInstance, hPrevInstance, lpszCmdLine, cmdShow)
  15. HANDLE hInstance, hPrevInstance;
  16. LPSTR lpszCmdLine;
  17. int cmdShow;
  18. {
  19.    char chBestDrive;                /* Drive Letter of the best           */
  20.                                     /*  performance drive in system.      */
  21.    char szbuf[80];                  /* Output buffer.                     */
  22.  
  23.    MessageBox(NULL,
  24.           (LPSTR)"Hit OK to return the highest \
  25. performance drive in the system \
  26. for temp files.",
  27.               (LPSTR)"Drive Test",
  28.               MB_OK);
  29.  
  30.    chBestDrive = GetTempDrive('A'); /* Get the temp drive.                */
  31.  
  32.    sprintf(szbuf, "%s%c%s\0",       /* Set up report in output buffer.    */
  33.            "Drive ", chBestDrive,
  34.        ": is the best performance drive in the system \
  35. for temporary files.");
  36.  
  37.    MessageBox(NULL,                 /* Show the user which drive is best. */
  38.               szbuf,
  39.               (LPSTR)"GetTempDrive",
  40.               MB_OK);
  41.  
  42. } /* WinMain */
  43.