At 10:55pm -0800 99-11-12, Palm Developers Forum List wrote:
>Date: 12 Nov 1999 07:24:42 -0800
>From: Andrew Ball <[EMAIL PROTECTED]>
>Subject: Length of string / DateToDOWDMFormat( )
>
>Newbish question:
>
>Under OS 3.0 in Datetime.h:
>
>longDateStrLength = 15
>
>I notice that in the 3.5 headers:
>
>#define longDateStrLength              15
>#define dowDateStringLength            19
>#define dowLongDateStrLength   25
>
>"Wed Nov 11, 1999" = 16 characters, 17 with the terminator.
>
>I'm trying to use the correct defined return length, but none of these seem
>to directly correspond.  Is there extra padding for localised versions of
>the string?

Yes, that's the idea.

>Which value is Palm suggesting gets returned from the API call
>DateToDOWDMFormat( )?

dowDateStringLength is the maximum length of the returned text, if 
you're not passing one of the long date formats (e.g. 
dfMDYLongWithComma) to DateToDOWDMFormat. Otherwise the max length is 
dowLongDateStrLength.

>What does dowLongDateStrLength pertain to?

See above.

>For that
>matter, what function returns a string of longDateStrLength?

DateToAscii(), if you pass one of the long date format selectors to 
it, otherwise the max length it returns is dateStringLength.

>Finally, I'm
>assuming that none of these return values include space for the \0, right?

Nope, sorry. Unfortunately the definition of strings lengths in 
inconsistent in the OS, and this is a case where you'd want to 
allocate a buffer of max size + 1 (for the terminating null).

Note that the new DateTemplateToAscii() routine has a max string 
length parameter that gets passed to it, and this _does_ include the 
terminating null, so that you can call it with sizeof(variable).

-- Ken

Ken Krugler
TransPac Software, Inc.
<http://www.transpac.com>
+1 530-470-9200 (direct) +1 408-261-7550 (main)

Reply via email to