Elementary string functions in MS C2008
Posted on 2011-09-15
I’m programmer with 10+ years in industry, but totally new to MS C 2008 and I need help. Look that works with string in C is TOTALLY different than to Vb6 or C# :-( :-( :-(. Please helppppppppp.
Look my code and read the comments, the question is on it.
BSTR CCPlayCtrl::sDecoderInfo(long lCard)
CString strResult;LPCTSTR strVersion;
int iNumDecoders = 0; long lRev = 0;
if (hDecoder != INVALID_STRADIS_HANDLE) return strResult.AllocSysString();
lRev = Stradis_GetRevision();
iNumDecoders = Stradis_GetNumberOfDecoders();
if (StradisDecoder_IsVersion2(hDecoder)) strVersion="2"; // how to put value "2" in LPCTSTR ??? Or may be I need other type?
if (StradisDecoder_IsVersion3(hDecoder)) strVersion="3";
if (StradisDecoder_IsVersion4(hDecoder)) strVersion="4";
return lRev + "," + iNumDecoders + "," + strVersion // how to join all 3 values in a one string and return it to BSTR ??? if I join it to CString will be fine
// return strResult.AllocSysString(); this is OK like return type
Please, give me working code, not links to pages where is explain how C works with strings ¿. You can replace STradis function with constants, for example like
if (true) strVersion="3";