To write a program, the content in cstring must be converted to int. I want to use atoi (). However, the system prompts that w_char * is different from char * and cannot be converted.
I checked a lot of information and finally saw the "cstring conversion" http://kingsong1980.blog.163.com/blog/static/1060113262010717102728177/ written by the canal fisherman.
Where:
3. Convert cstring type to int type
The simplest way to convert data of the cstring type to an integer type is to use a standard string to an Integer Conversion routine.
Although you usually suspect that using the _ atoi () function is a good choice, it is rarely the right choice. If you want to use Unicode characters, you should use _ ttoi (), which is compiled into _ atoi () in the ANSI coding system (), in the Unicode encoding system, encode it into _ wtoi (). You can also consider using _ tcstoul () or _ tcstol (), which can convert strings into any hexadecimal long integers (such as binary, octal, decimal, or hexadecimal ), the difference is that the converted data is unsigned, while the converted data is unsigned. See the following example:
Cstring hex = _ T ("fab ");
Cstring decimal = _ T ("4011 ");
Assert (_ tcstoul (Hex, 0, 16) = _ ttoi (decimal ));
I also want to do something for you.