QString to LPCTSTR conversion
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?
Which compiler are you using?
How did you perform the conversion?
LPCTSTR = Long Pointer to a Const TCHAR STRing
Try the simple casting.
Try "QString::toWCharArray() ":http://doc.qt.nokia.com/4.7/qstring.html#toWCharArray.
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(), ...