QByteArray convert to/from unsigned char *
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: QByteArray inArray = " ... "; unsigned char *in = convert1(inArray); unsigned char *out; someFunction(in, out); QByteArray outArray = convert2(out); the question is how can I correctly make these conversions (convert1 and convert2). I cannot change someFunction(unsigned char *, unsigned char *), but I have to work with QByteArray here. 回答1: Qt has really great docs , you should use them. If someFunction doesn't modify or store pointer to in data you can use this: QByteArray inArray = " ... "; unsigned char *out; someFunction((unsigned char*)