Wednesday, May 30, 2007

C++: convert managed clr System::String^ to std::string

#include vcclr.h

System::String^ line = "a managed string";
pin_ptr wch = PtrToStringChars( line );
int len = (( line->Length+1) * 2);
char *ch = new char[ len ];
wcstombs( ch, wch, len );
string lineStr = ch;
delete ch;

Li-po battery charging tips

avoid charging above 80% and discharging below 20% to maximize battery lifespan. While they can be charged to 100% and discharged to 0%, doi...