delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/01/13/12:17:44

Message-ID: <3E22E5B5.B72EB02@yahoo.com>
Date: Mon, 13 Jan 2003 11:13:41 -0500
From: CBFalconer <cbfalconer AT yahoo DOT com>
Organization: Ched Research
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
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>
Reply-To: djgpp-workers AT delorie DOT com

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.

-- 
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019