delorie.com/archives/browse.cgi | search |
Sender: | rich AT phekda DOT freeserve DOT co DOT uk |
Message-ID: | <3E230161.96BB0D4F@phekda.freeserve.co.uk> |
Date: | Mon, 13 Jan 2003 18:11:45 +0000 |
From: | Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk> |
X-Mailer: | Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586) |
X-Accept-Language: | de,fr |
MIME-Version: | 1.0 |
To: | djgpp-workers AT delorie DOT com |
Subject: | Re: FILENAME_MAX - does it include a nul terminator? |
References: | <3E22D46D DOT 116FDB95 AT phekda DOT freeserve DOT co DOT uk> <3E22E5B5 DOT B72EB02 AT yahoo DOT com> |
Reply-To: | djgpp-workers AT delorie DOT com |
Hello. CBFalconer wrote: > > Richard Dawe wrote: > > > ... snip ... > > > > There checks for there being enough buffer space: > > > > if (strlen(foo) > FILENAME_MAX) > > do_something; > > else > > return(an_error). > > > > Surely the test should be >= FILENAME_MAX? > > ITYM <, allowing for the terminal '\0'. > > "FILENAME_MAX >= strlen(foo)" would also express it. Yes, you are right. The case that caused me to ask the initial question returns an error as its "do_something". Thanks, bye, Rich =] -- Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |