Solved

textEdit->Text to LPTSTR

Posted on 2006-11-20
2
250 Views
Last Modified: 2010-04-24
Hello,

Could anyone give me an example of how to convert from a System::String to LPTSTR?

Thank you very much
0
Comment
Question by:aureliuh
2 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 total points
Comment Utility
#include <atlstr.h>
...

    String^ s = L"test";
    CString s1(s);

    LPTSTR s2 = (LPTSTR)(LPCTSTR)s1;

CStringT class has constructor which accepts String^. Then CStringT is casted to LPTSTR. This code doesn't require MFC dependency.
0
 

Author Comment

by:aureliuh
Comment Utility
Thank you very much! It really helped me.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now