Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

using _countof

13 views
Skip to first unread message

James5950

unread,
Mar 7, 2008, 9:35:02 AM3/7/08
to
Dear All,

How to use _countof(m_szFileName) on BCB2007?

Thanks for any comments,
Best regards,
James

Darko Miletic

unread,
Mar 7, 2008, 11:59:29 AM3/7/08
to
James5950 wrote:
> Dear All,
>
> How to use _countof(m_szFileName) on BCB2007?

It is called RTL_NUMBER_OF in BCB2007. To use it include windows.h.

James5950

unread,
Mar 7, 2008, 12:20:03 PM3/7/08
to
>> How to use _countof(m_szFileName) on BCB2007?
>
> It is called RTL_NUMBER_OF in BCB2007. To use it include windows.h.

The original code like this

WCHAR m_szFileName[256];

//MS use _countof(m_szFileName) to get the size of m_szFileName.
wcsncpy_s(m_szFileName, _countof(m_szFileName), pszFileName, _TRUNCATE);
I use sizeof(m_szFileName) for instead now.

Best regards
James

Darko Miletic

unread,
Mar 8, 2008, 4:33:29 PM3/8/08
to

Just replace _countof with RTL_NUMBER_OF and you got the same thing, or
you can put this small define in the code

#ifdef __BORLANDC__
#define _countof RTL_NUMBER_OF
#endif

and you do not need to change the code at all.

James5950

unread,
Mar 9, 2008, 4:32:19 AM3/9/08
to
Thank you Darko.
0 new messages