How to do Data Type Conversion in VC++ ?

  1. From CString to BSTR

CString str = “Alice In Wonder Land” ;
BSTR bs = str.AllocSyString( ) ;

  1. From char* to BSTR

char *s = “KICIT,Nagpur” ;
bstr_t b = s ;

  1. From string to double, long, integer

char *s = “567.45″ ;
double d = atof ( s ) ;
s = “54678″ ;
long l = atol ( s ) ;
s = “345″ ;
int i = atoi ( s ) ;

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>