This article is a mirror article of machine translation, please click here to jump to the original article.

View: 11441|Reply: 0

[C] MFC's LPSTR type writing

[Copy link]
Posted on 7/3/2019 9:16:39 AM | | |
(LPSTR) Which idiot invented (LPCTSTR)str?
Original post address: http://bbs.csdn.net/topics/340000641(LPSTR)(LPCTSTR)str Which idiot invented it?
CString str;
Then in order to pass in the ANSI string
(LPSTR) (LPCTSTR)str

Who was the idiot who wrote this kind of garbage code in the first place?

It's everywhere on the Internet, and almost everyone who uses MFC has seen or even written about it!

Even if it is VC6, there is no problem in writing the result like this, has no one thought about the meaning of LPCTSTR having an extra T? Isn't there anyone who has seen that you can still choose the UNICODE library when installing VC6? The lite version of VC6 is used too much!

UNICODE environment is written correctly
CString str;
CStringA strA(str);
strA.GetString(); or strA.GetBuffer(0);

Using APIs? It is also equipped with B, this is MFC!

Isn't there a person who writes such a simple thing as character conversion correctly?

shit!







Previous:C++ Summary of methods referencing Lib and Dll
Next:.net/c# User multithreaded concurrency lock(string){...} Detailed explanation
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com