Jump to content
  • Advertisement
Sign in to follow this  
tom_mai78101

LPCSTR and LPCWSTR template in C: Is it standard?

This topic is 2840 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Here's the code:

Capture-2.png

[color="#008000"]This is a temporary solution to the buggy Code tag. I'm proud of it.

Anyway, as you can see here, I defined a FILENAME macro to either LPCSTR or LPCWSTR, depending on UNICODE if it's defined or not. I mimicked this from any windows.h header files. I am wondering if this is used for passing either LPCSTR or LPCWSTR parameters to a function(s), but since I had compiled this pretty fine, I wouldn't think much about it.

Is this a standard C method?

Share this post


Link to post
Share on other sites
Advertisement
How about using LPCTSTR (note the T) and include windows.h? Or you can just use UNICODE for all files and not even bother with switching. Just assume you'll always use UNICODE. I imagine the usage of UNICODE or not in windows headers was less about you the programmer being able to compile in both unicode and multi-byte in the same project and more about allowing different projects to pick one or the other.

Share this post


Link to post
Share on other sites

How about using LPCTSTR (note the T) and include windows.h? Or you can just use UNICODE for all files and not even bother with switching. Just assume you'll always use UNICODE. I imagine the usage of UNICODE or not in windows headers was less about you the programmer being able to compile in both unicode and multi-byte in the same project and more about allowing different projects to pick one or the other.


Oh thanks for the reminder.

Note to Self: LPTSTR is UNICODE-wise (Configurable) type. LPCTSTR is UNICODE-wise (selectable) constant type.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!