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 ) ;

Subscribe / Share

It's very calm over here, why not leave a comment?

Leave a Reply




Categories

Powered by Yahoo! Answers