BSTR
-
Hello, can somebody please help me: i'm trying to write a string to a file serverside. and i want to get the string back. So i use the next function: MIDL :write [in]BSTR message cpp: HRESULT Write(BSTR message) { //code to write to a file on the server } can u please explane how the BSTR type works and how can i convert it to a normal string
-
Hello, can somebody please help me: i'm trying to write a string to a file serverside. and i want to get the string back. So i use the next function: MIDL :write [in]BSTR message cpp: HRESULT Write(BSTR message) { //code to write to a file on the server } can u please explane how the BSTR type works and how can i convert it to a normal string
CString str = _T("") str = message; Carlos Antollini. Sonork ID 100.10529 cantollini
-
Hello, can somebody please help me: i'm trying to write a string to a file serverside. and i want to get the string back. So i use the next function: MIDL :write [in]BSTR message cpp: HRESULT Write(BSTR message) { //code to write to a file on the server } can u please explane how the BSTR type works and how can i convert it to a normal string
One of the easiest way to use the BSTR type as normal string, in my opinion is to use the compiler string type: _bstr_t Use like this:
HRESULT Write(BSTR message)
{
_tprintf(TEXT("Message:%s\r\n", (LPCTSTR) _bstr_t(message));
}You can look at the description for
_bstr_t
in MDSN for more help. It can also convert ASCII string to Unicode. You may want to use conversion macro.HRESULT Write(BSTR message)
{
USES_CONVERSION;
LPCTSTR lpszNormal = OLE2CT(message);
_tprintf(TEXT("Message:%s\r\n", (LPCTSTR) lpszNormal);
} -
CString str = _T("") str = message; Carlos Antollini. Sonork ID 100.10529 cantollini
CString str(message)
-
One of the easiest way to use the BSTR type as normal string, in my opinion is to use the compiler string type: _bstr_t Use like this:
HRESULT Write(BSTR message)
{
_tprintf(TEXT("Message:%s\r\n", (LPCTSTR) _bstr_t(message));
}You can look at the description for
_bstr_t
in MDSN for more help. It can also convert ASCII string to Unicode. You may want to use conversion macro.HRESULT Write(BSTR message)
{
USES_CONVERSION;
LPCTSTR lpszNormal = OLE2CT(message);
_tprintf(TEXT("Message:%s\r\n", (LPCTSTR) lpszNormal);
}CComBSTR
-
Hello, can somebody please help me: i'm trying to write a string to a file serverside. and i want to get the string back. So i use the next function: MIDL :write [in]BSTR message cpp: HRESULT Write(BSTR message) { //code to write to a file on the server } can u please explane how the BSTR type works and how can i convert it to a normal string
-
Hello, can somebody please help me: i'm trying to write a string to a file serverside. and i want to get the string back. So i use the next function: MIDL :write [in]BSTR message cpp: HRESULT Write(BSTR message) { //code to write to a file on the server } can u please explane how the BSTR type works and how can i convert it to a normal string
There are 2ways to do this The first method uses the OLE2T() for BSTR conversion to string. The second method uses _bstr_t for conversion. ******************************************************#inclu#include #include #include void main() { BSTR b=L"StringConversion"; //BSTR string USES_CONVERSION; //First method of Conversion cout<<"String :"<