1. It should be _countof(text) instead of sizeof(text).
From MSDN:
sizeOfBuffer
Maximum number of characters to store.
2. WORD means unsigned short and its max value is 65535 which requires at least 6-character buffer for formatting (5 for digits + 1 for terminating NULL)
I wonder why you are searching for "quick" solution instead of a correct and clean one!
What is wrong with MFC CString?
Why do you pass in a wrong value of the text buffer size?
Bookmarks