Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 COM, write BSTR to text file

views
     
TSV3i HoN6
post Feb 21 2006, 04:56 PM, updated 20y ago

ǝlıɥdouɥɔɐɹɐ
******
Senior Member
1,617 posts

Joined: Mar 2005



I have this COM program,
in one of the method


STDMETHODIMP CCMSHdl::RecvMessage(BSTR msg)
{
FILE *fptr;
fptr=fopen( "Status.txt", "a+" );

if ( NULL != fptr )
{
fprintf( fptr, "%s" , msg );
}

return S_OK;
}

Then use another VB program to send in a string say "Hello".

But the textfile only written "H", or whatever first character of the string i sent.

Can anyone tell me what's wrong with it?
could it be this line -- fprintf(fptr, "%s", msg );
where i should put something else instead of "%s" for BSTR?

This post has been edited by V3i HoN6: Feb 21 2006, 04:57 PM

 

Change to:
| Lo-Fi Version
0.0133sec    0.40    6 queries    GZIP Disabled
Time is now: 24th December 2025 - 01:33 AM