🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #1914

buffer sizes for filenames, pathnames etc.

#1914
From: John Grant
Date: Thu, 31 Dec 1992 01:37
44 lines
1802 bytes
Ok, somebody explain this...

	Function		Buffer Size Required
	-----------------------------------------------------
	GetSystemDirectory	144
	GetWindowsDirectory	144
	GetSystemDir		unspecified
	GetWindowsDir		unspecified
	GetModuleFileName	unspecified (example uses 260)

	(I got the above numbers from on-line help for BC++ 3.1)

	Include File		Definition
	------------------------------------------------
	dir.h			#define MAXPATH      80
	stdlib.h		#define _MAX_PATH    80
	stdio.h			#define FILENAME_MAX 80
	toolhelp.h		#define MAX_PATH     255

Now it seems to me that there should only have to be one definition
	#define MAX_LENGTH_PATHNAME	??
regardless of whether or not we are using DOS or Windows.
This is the size of the buffer required to hold the longest possible
pathname, including drive, directory, filename and extension.

As noted above, there are several defined constants and 3 other numbers
which are not defined symbolically.  I really don't feel like hard-coding
numbers in my programs.

Now when Windows becomes Windows NT, then it probably needs to be
redefined for the new file system, but it can *still* be done with
a single #defined constant:
	#ifdef WIN_NT
	  #define MAX_LENGTH_PATHNAME xx
	#else
	  #define MAX_LENGTH_PATHNAME yy
	#endif

So which is it?  80, 144, 255, 260???

-- 
John A. Grant						jagrant@emr1.emr.ca
Airborne Geophysics
Geological Survey of Canada, Ottawa
Technical Details
Message-ID: <1992Dec31.013722.18655@emr1.emr.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!torn!nott!emr1!jagrant

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.ms-windows.programmer.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!torn!nott!emr1!jagrant
From: jagrant@emr1.emr.ca (John Grant)
Subject: buffer sizes for filenames, pathnames etc. 
Message-ID: <1992Dec31.013722.18655@emr1.emr.ca>
Organization: Energy, Mines, and Resources, Ottawa
Date: Thu, 31 Dec 1992 01:37:22 GMT
Lines: 44