2009年1月17日 星期六

BCB note - Char & AnsiString Transformation

As title!
In string operation, we usually transform char to AnsiString data type for BCB objects such as Edit, StringGrid, Memo and Label etc. Besides, AnsiString transform to char data type is also used for traditional file read/write. The codes could be written below (Success testing in BCB):

// AnsiString To Char
AnsiString as = "test";
char *chr;
chr = as.c_str();

// Char To AnsiString
char *chr="test";
AnsiString as;
as = StrPas(chr);

沒有留言: