how to convert char to LPCTSTR in vc++
+1
A:
if you are using MFC (is your label supposed to be MFC instead of MVC?):
char name[] = "your name";
CString sName(name);
LPCTSTR lpszName = sName;
if you are using Qt, take a look at QString and QByteArray
// (1)
QString filename;
LPCWSTR lpszFilename = filename.utf16(); // alternatively, .unicode()
// alternatively, (2)
QByteArray qBA("abcdef.txt");
QString qString(qBA);
LPCWSTR lpszFileName = qString.utf16(); // or, .unicode() , .utf8()
...
sf.pFrom = lpszFileName;
afriza
2010-03-29 08:38:11
you should put your block of code in the question preceded by a newline and prefix them with 4 spaces for every line of codes. click 'edit' somewhere near your question.
afriza
2010-03-29 08:57:08
it seems like you are using Qt, please add that to the label.
afriza
2010-03-29 08:59:01
I am using MVC. QByteArray qBary; qBary.append(temp); char toChar[512]; for(int ii=0;ii<512;ii++) { toChar[ii]=qBary[ii]; if(qBary[ii]=='\0') { break; } } SHFILEOPSTRUCT sf; memset( sf.hwnd = 0; sf.wFunc = FO_COPY; sf.pFrom = toChar; // error occurring here
2010-03-29 09:00:04
A:
I am using MVC.
QByteArray qBary;
qBary.append(temp);
char toChar[512];
for(int ii=0;ii<512;ii++)
{
toChar[ii]=qBary[ii];
if(qBary[ii]=='\0')
{ break;
} }
SHFILEOPSTRUCT sf;
memset(&sf,0,sizeof(sf));
sf.hwnd = 0;
sf.wFunc = FO_COPY;
sf.pFrom = toChar; // error occurring here