What does "Cch" mean in StringCchPrint*?

Viewed 131

fprintf means "[f]ile [print] [f]ormatted".

For the StringCchPrint* family (https://docs.microsoft.com/en-us/windows/win32/api/strsafe/nf-strsafe-stringcchprintfa), I can't find anything mentioning [Cch].

I know that the A suffix denotes char, the f suffix denotes TCHAR (text char? which appears to be what they want the deafult data type to be for this type of stuff?) and W denotes WCHAR (wide char?)

I have no experience with windows naming conventions, this is confusing.

1 Answers

The (lowercase) "ch" part of the names refers to the fact that these functions take a count of characters as their relevant argument(s), as opposed to the related functions with a "b" in their names (such as StringCbPrintf), which take a count of bytes. (These counts are different when using UNICODE builds, where the strings are formed of 2-byte wchar_t elements.)

Further, as pointed out by dxiv, the uppercase "C" stands for "count" - which is similar to the Microsoft naming convention for structure members that are 'counts', such as .cbSize or .cchLength.

Related