Collect:
1\ Convert int to LPCTSTR
In fact LPCTSTR can be directly replaced with CString without type casting
CString str; intNumber= the; //str= " "Str. Format (_t ("%d"), number); //str= "15" (preceded by two spaces, 4 means 4 bits will be used, if the number exceeds 4 bits will output all numbers, will not be truncated)Str. Format (_t ("%4d"), number); //str= "0015" (. 4 means 4 bits will be consumed if the number exceeds 4 bits will output all digits and will not be truncated)Str. Format (_t ("%.4d"), number); //the method of converting a long to CString is similar to the above, just change%d to%ld.
The format description always starts with a% character, and the following is a description of how the different types of data are formatted as% numbers:
D Output signed decimal number
o Output unsigned octal number
x output unsigned hexadecimal number
U Output unsigned number
C Output Single character
s output a string of characters
F Output Real number (6 decimal places)
E output real numbers in exponential form
G Choose the format of the output width in F and e format, do not output 0
LD input-Output Long data
LF input/output double type data
m data output width m
. n Output decimal digits N
C + + several ways to convert data to strings