L prefix for strings in C++

前端 未结 5 1597
遇见更好的自我
遇见更好的自我 2021-01-05 10:45

I have a static library. This library have the following function defined

int WriteData(LPTSTR s)

The sample to call the function is

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-05 11:22

    I would wrap your strings in the _T(...) macro. That way its portable between ANSI and UNICODE builds.

    Note that you are using the portable string type - LPTSTR - note the T. It will change between ANSI and UNICODE based on build settings.

提交回复
热议问题