如何铸造一个LONG到CString? [英] How to cast a LONG to a CString?

查看:104
本文介绍了如何铸造一个LONG到CString?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想把一个长链接到一个cstring。

I want to cast a long to a cstring.

我一直在努力工作一段时间,我见过这么多的解决这个问题的变种,或多或少有麻烦和焦虑。

I've been struggling with this for a while and I've seen so many variants of solving this problem, more or less riddled with hassle and angst.

我知道这个问题似乎是主观的,但它真的不应该在我看来。当情况涉及MFC和与这些情况一起出现的标准库时,必须有一种被认为是最好的方法。

I know the question seems subjective, but it really shouldn't be in my opinion. There must be a way considered to be the best when the circumstances involve MFC and the standard libs that come with those circumstances.

我正在寻找一个单行的解决方案,只是工作。像C#中的long.ToString()一样排序。

I'm looking for a one-line solution that just works. Sort of like long.ToString() in C#.

推荐答案

它很简单:

long myLong=0;
CString s;

// Your one line solution is below
s.Format("%ld",myLong);

这篇关于如何铸造一个LONG到CString?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆