Re: _stprintf
- From: "Mihai N." <nmihai_year_2000@xxxxxxxxx>
- Date: Mon, 31 Jul 2006 23:02:03 -0700
The documentation for StringCchPrintf talks about counts of characters. In....
an ANSI compilation each character occupies one or two TCHARs depending on
the actual character. The documentation for StringCchPrintf doesn't say
that TCHARs are counted where it does say that characters are counted.
Dr. Newcomer, you KNOW how, in an ANSI compilation, one 2-TCHAR character
will overflow a buffer which has enough space for only one 1-TCHAR
character.
I suspect it is the typical MSDN confusion when talking about characters.
Since in strsafe.h I can find both StringCchPrintfA and StringCchPrintfW,
I assume it works like all the Win32 API with regard to buffer lengths.
Meaning that when they say "character" in ANSI context, one should really
understand char. So 2 TCHAR character in a 1 TCHAR buffer will trigger
a "not enough space" error (not tested, but I am quite sure).
If this is not the case, it is definitely a bug.
When the documentation talks about character, then is a char in ANSI and
wchar_t/WCHAT in Unicode, totaly unaware of DBCS, surrogates, combining
chars.
There are in fact very few APIs that deal with what the "user character"
--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
.
- References:
- Re: _stprintf
- From: Joseph M . Newcomer
- Re: _stprintf
- From: Norman Diamond
- Re: _stprintf
- From: Joseph M . Newcomer
- Re: _stprintf
- From: Norman Diamond
- Re: _stprintf
- Prev by Date: Re: Cannot open include file: 'iphlpapi.h':
- Next by Date: Re: ANSI string from UNICODE app.
- Previous by thread: Re: _stprintf
- Next by thread: Re: _stprintf
- Index(es):
Relevant Pages
|