TransWikia.com

What does "Cch" mean in StringCchPrint*?

Stack Overflow Asked by Ari Sweedler on January 1, 2022

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.

One Answer

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.

Answered by Adrian Mole on January 1, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP