Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QString to LPCTSTR conversion
Indrajeet last edited by
I am using win32 dll in my -QT- Qt Application.
win32 dll has one function which takes parameter of type LPCTSTR.
When i try to call this function from my Qt Application passing QString as parameter function is not recieveng the correct value .
How to resolve this?
koahnig last edited by
Which compiler are you using?
How did you perform the conversion?
broadpeak last edited by
LPCTSTR = Long Pointer to a Const TCHAR STRing
Try the simple casting.
goetz last edited by
Try "QString::toWCharArray() ":http://doc.qt.nokia.com/4.7/qstring.html#toWCharArray.
giesbert last edited by
If it is a pure in parameter, you can try:
void fooSub(LPSTSTR X); // this is our function :-)
if(sizeof(TCHAR) == 1)
fooSub((LPCSTR)text.toLocal8Bit().constData()); // here you have to check, how to convert, you could also use utf8(), ...