Symbian 字符打印

发布于 2024-08-02 15:41:55 字数 271 浏览 3 评论 0原文

我正在尝试构建一个非常简单的概念证明,我可以编写一个 Web 服务并实际从 symbian 环境调用该服务。该服务是一个简单的 Hello 服务,它采用 const char* 形式的名称,并返回“hello”+ char* 形式的名称形式的问候语。我的问题是,如何将 char* 转换为 TPtrC16,以便我可以使用 console->Write 函数将响应打印到屏幕上?我知道我可以搜索 API 并弄清楚这一点,但对于基本的概念演示,我宁愿不花时间(不确定我是否会再次使用 Symbian)。

谢谢!

I am attempting to construct a very simple proof of concept that I can write a web service and actually call the service from a symbian environment. The service is a simple Hello service which takes a name in the form of a const char* and returns back a greeting of the form "hello " + name in the form of a char*. My question is, how do I convert a char* to a TPtrC16 so that I can use the console->Write function to print out the response to screen? I know I could search through the API and figure this out, but for a basic conceptual demo I'd rather not spend the time (not sure that Symbian is something I will ever work with again).

Thanks!

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

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

发布评论

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

评论(1

月亮是我掰弯的 2024-08-09 15:41:55

如果 const char* 字符串采用 US-ASCII,您可以使用 TDes::Copy 将其包装在 TPtrC8 中复制到 16 -bit 描述符:

const char *who = "world";
TBuf<128> buf;
buf.Copy(TPtrC8((TText8*)who));
console->Printf(_L("hello %S\n"), &buf);

如果是其他编码,请查看 SDK 帮助中的 charconv API。

If the const char* string is in US-ASCII, you can use TDes::Copy to copy it wrapped in a TPtrC8 to a 16-bit descriptor:

const char *who = "world";
TBuf<128> buf;
buf.Copy(TPtrC8((TText8*)who));
console->Printf(_L("hello %S\n"), &buf);

If it is in some other encoding, have a look at the charconv API in the SDK help.

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