I use the Unicode character set.< br>What’s wrong with the multi-byte character set? Or better yet, why should I use Unicode?
Take this code in the DLL I am working on as an example
RECORD_API int startRecording(
char *cam_name, // Friendly video device name
char *time, // Max time for recording
char *f_width, // Frame width
char *f_height, // Frame height
char *file_path) // Complete output file path
{
...
}
Many Unicode functions in the Windows.h header file use wchar_t parameters; I should use wchar_t as mine Function parameters?
Should I always specify the W function (for example: ShellExecuteW)?
An additional complexity, but for more complex operations, it may be
easier to work in UTF-16. (Although there is a difference between
UTF-8 and UTF-16 are not very large. To To get any real benefits,
you have to use UTF-32, even so…)
In practice, I would completely avoid using W functions and always use char const at the system interface level *. But again, it depends on what you are doing. This is just a general guide. For the rest, I will stick to std::string unless there are some strong reasons not to do so.
I saw in the project properties on Visual Studio 2012 that you can select the character set for the application.
I use the Unicode character set.
Multi-character What’s wrong with the section character set? Or better yet, why should I use Unicode?
Take this code in the DLL I am working on as an example
RECORD_API int startRecording(
char *cam_name, // Friendly video device name
char *time, // Max time for recording
char *f_width, // Frame width
char *f_height, // Frame height
char *file_path) // Complete output file path
{
...
}
Many Unicode functions in the Windows.h header file use wchar_t parameters; I should use wchar_t as mine Function parameters?
Should I always specify the W function (for example: ShellExecuteW)?
First of all, no matter what the interface says, the question is not whether it is Unicode, but UTF-16 or UTF-8. In fact, for
For external data, you should only use UTF-8. Internally, it
depends on what you are doing. Converting UTF-8 to UTF-16 is
an additional complexity, but for more complex Operation, it may be
easier to work in UTF-16. (Although there is a difference between
UTF-8 and UTF-16 is not very big. To get any real benefits,
you have to use UTF-32, even so…)
In practice, I would completely avoid using W functions and always use char const * at the system interface level. But again, it depends on what you are doing This is just a general guide. For the rest, I will stick to std::string unless there are some strong reasons not to do so.