home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / mswindo / programm / misc / 4523 < prev    next >
Encoding:
Text File  |  1992-12-30  |  1.7 KB  |  54 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!spool.mu.edu!torn!nott!emr1!jagrant
  3. From: jagrant@emr1.emr.ca (John Grant)
  4. Subject: buffer sizes for filenames, pathnames etc. 
  5. Message-ID: <1992Dec31.013722.18655@emr1.emr.ca>
  6. Organization: Energy, Mines, and Resources, Ottawa
  7. Date: Thu, 31 Dec 1992 01:37:22 GMT
  8. Lines: 44
  9.  
  10. Ok, somebody explain this...
  11.  
  12.     Function        Buffer Size Required
  13.     -----------------------------------------------------
  14.     GetSystemDirectory    144
  15.     GetWindowsDirectory    144
  16.     GetSystemDir        unspecified
  17.     GetWindowsDir        unspecified
  18.     GetModuleFileName    unspecified (example uses 260)
  19.  
  20.     (I got the above numbers from on-line help for BC++ 3.1)
  21.  
  22.     Include File        Definition
  23.     ------------------------------------------------
  24.     dir.h            #define MAXPATH      80
  25.     stdlib.h        #define _MAX_PATH    80
  26.     stdio.h            #define FILENAME_MAX 80
  27.     toolhelp.h        #define MAX_PATH     255
  28.  
  29. Now it seems to me that there should only have to be one definition
  30.     #define MAX_LENGTH_PATHNAME    ??
  31. regardless of whether or not we are using DOS or Windows.
  32. This is the size of the buffer required to hold the longest possible
  33. pathname, including drive, directory, filename and extension.
  34.  
  35. As noted above, there are several defined constants and 3 other numbers
  36. which are not defined symbolically.  I really don't feel like hard-coding
  37. numbers in my programs.
  38.  
  39. Now when Windows becomes Windows NT, then it probably needs to be
  40. redefined for the new file system, but it can *still* be done with
  41. a single #defined constant:
  42.     #ifdef WIN_NT
  43.       #define MAX_LENGTH_PATHNAME xx
  44.     #else
  45.       #define MAX_LENGTH_PATHNAME yy
  46.     #endif
  47.  
  48. So which is it?  80, 144, 255, 260???
  49.  
  50. -- 
  51. John A. Grant                        jagrant@emr1.emr.ca
  52. Airborne Geophysics
  53. Geological Survey of Canada, Ottawa
  54.