I am using visual studio 2010 MFC to build a C++ program. My program calls a DLL that is not apart of the project and it accepts a char*. I have a function that gets a string in
LPCTSTR patientName= L"";
CStringA sB(patientName);
const char* pszC = sB;
DcmFileFormat fileformat;
//Type casting below to const char * str
OFCondition status = fileformat.loadFile(((LPCSTR)(CStringA)str));
if (status.good())
{
if (fileformat.getDataset()->findAndGetString(DCM_PatientName, pszC).good())
{
//Type casting from const char * to LPCTSTR
m_List.InsertColumn(4, LPCTSTR(pszC) , LVCFMT_LEFT, 100);
}
}
This was the way i used to typecast the variables