Symbian C++ 中的 unsigned char* 到 const TDesC8

发布于 2024-07-29 12:41:19 字数 370 浏览 1 评论 0原文

我想通过 Socket 发送一个 unsigned char * ,而 RSockt.Send 具有以下签名:

IMPORT_C void Send(const TDesC8 &aDesc, TUint someFlags, TRequestStatus &aStatus);

我尝试按以下方式执行此操作,但这给了我一条错误消息:

Socket.Send( TPtrC8 ptr((TUint8*)charvariable), 0, iStatus);

Error #254: Type name is not allowed.

还有其他建议吗?

谢谢

I wanna send an unsigned char * over the Socket whereas the RSockt.Send has the following signature:

IMPORT_C void Send(const TDesC8 &aDesc, TUint someFlags, TRequestStatus &aStatus);

I tried to do it the following way but that gives me an error message:

Socket.Send( TPtrC8 ptr((TUint8*)charvariable), 0, iStatus);

Error #254: Type name is not allowed.

Any other suggestions?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光礼记 2024-08-05 12:41:19

您很接近,但无法在表达式中声明变量。 具体方法如下:

Socket.Send(TPtrC8((TUint8*)charvariable), 0, iStatus);

请注意,这假设 unsigned char * 数据以零结尾。

You were close but you cannot declare a variable within an expression. Here's how:

Socket.Send(TPtrC8((TUint8*)charvariable), 0, iStatus);

Note that this assumes the unsigned char * data is zero terminated.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文