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

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. From: chris@chrism.demon.co.uk (Chris Marriott)
  3. Path: sparky!uunet!pipex!demon!chrism.demon.co.uk!chris
  4. Subject: Re: buffer sizes for filenames, pathnames etc. 
  5. Distribution: world
  6. References: <1992Dec31.013722.18655@emr1.emr.ca>
  7. Organization: None
  8. Reply-To: chris@chrism.demon.co.uk
  9. X-Mailer: Simple NEWS 1.90 (ka9q DIS 1.19)
  10. Lines: 71
  11. Date: Thu, 31 Dec 1992 19:39:50 +0000
  12. Message-ID: <725830790snz@chrism.demon.co.uk>
  13. Sender: usenet@demon.co.uk
  14.  
  15. In article <1992Dec31.013722.18655@emr1.emr.ca> jagrant@emr1.emr.ca writes:
  16.  
  17. >Ok, somebody explain this...
  18. > [ stuff deleted]
  19. >
  20. >Now it seems to me that there should only have to be one definition
  21. >        #define MAX_LENGTH_PATHNAME     ??
  22. >regardless of whether or not we are using DOS or Windows.
  23. >This is the size of the buffer required to hold the longest possible
  24. >pathname, including drive, directory, filename and extension.
  25. >
  26. >As noted above, there are several defined constants and 3 other numbers
  27. >which are not defined symbolically.  I really don't feel like hard-coding
  28. >numbers in my programs.
  29. >
  30. >Now when Windows becomes Windows NT, then it probably needs to be
  31. >redefined for the new file system, but it can *still* be done with
  32. >a single #defined constant:
  33. >        #ifdef WIN_NT
  34. >          #define MAX_LENGTH_PATHNAME xx
  35. >        #else
  36. >          #define MAX_LENGTH_PATHNAME yy
  37. >        #endif
  38. >
  39. >So which is it?  80, 144, 255, 260???
  40. >
  41. >-- 
  42. >John A. Grant                                           jagrant@emr1.emr.ca
  43. >Airborne Geophysics
  44. >Geological Survey of Canada, Ottawa
  45. >
  46.  
  47. In DOS on a standalone machine, you're allowed 63 characters for the drive
  48. and directory, and another 12 for the filename, plus the NUL byte at the
  49. end.  That's a total of 76, hence (presumably) the "80" definition.  That
  50. 76 is a limitation of MS-DOS itself.
  51.  
  52. If you're on a network, things get more hairy.  On a LAN Manager network,
  53. at least, you're allowed to add a server and sharename to the start of the
  54. path, so you might have something like:
  55.  
  56.     \\app_server\word\myfiles\..... etc
  57.  
  58. I seem to recall (though I'm probably wrong!) that both server and sharename
  59. can be up to 16 characters long, which, with the separators, brings us
  60. up to 112 characters.
  61.  
  62. The solution you mention with NT, ie, saying:
  63.  
  64.     #ifdef WIN_NT
  65.        etc.
  66.  
  67. unfortunately doesn't work, either!  The trouble is, NT has installable
  68. file systems.  You can "plug in" a new file system and neither the NT
  69. Kernel *nor* any of the API subsystems (such as Win32) will know anything
  70. about it, as such. The limit on the length of a filename is a parameter of
  71. the file system currently being accessed, *not* of NT itself!
  72.  
  73. I think that you've raised an interesting point, though, certainly.
  74. Personally I use a file-name buffer of 256 characters now, just to be on
  75. the safe side.....
  76.  
  77. Chris
  78. -- 
  79. --------------------------------------------------------------------------
  80. | Chris Marriott                           | chris@chrism.demon.co.uk    |
  81. | Warrington, UK                           | BIX: cmarriott              |
  82. | (Still awaiting inspiration              | CIX: cmarriott              |
  83. |  for a witty .sig .... )                 | CompuServe: 100113,1140     |
  84. --------------------------------------------------------------------------
  85.  
  86.