PDA

View Full Version : QByteArray Problem



foxhengxing
18th August 2010, 03:37
I Wrote a function as follow

writedata(const char * buf);

then I call the function ,

QString test;
test ="Hello world world";
writedata(test.toAscii ());


I pass the parameter which is QByteArray type, but the function accept type is char *,why it can work?


Please help me,Thanks!

foxhengxing
18th August 2010, 04:04
I have found the answer,the reason is QByteArray override the operate const char *() as follow

QByteArray::operator const char * () const

Thanks everyone!