刚学MFC,一个简单的问题

wu_xiaoer 2005-05-30 08:24:01
我在学MFC时,想知道某个函数的具体用法怎么办,
比方说,看到CString类,想知道成员函数Format函数的用法,怎么办?
不能这样的问题也要到CSDN上发帖吧
...全文
127 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
monkey2005 2005-05-30
  • 打赏
  • 举报
回复
CString::Format

void Format( LPCTSTR lpszFormat, ... );

void Format( UINT nFormatID, ... );

Parameters

lpszFormat

A format-control string.

nFormatID

The string resource identifier that contains the format-control string.

Remarks

Call this member function to write formatted data to a CString in the same way that sprintf formats data into a C-style character array. This function formats and stores a series of characters and values in the CString. Each optional argument (if any) is converted and output according to the corresponding format specification in lpszFormat or from the string resource identified by nFormatID.

The call will fail if the string object itself is offered as a parameter to Format. For example, the following code:

CString str = "Some Data";
str.Format("%s%d", str, 123); // Attention: str is also used in the parameter list.

will cause unpredictable results.

When you pass a character string as an optional argument, you must cast it explicitly as LPCTSTR. The format has the same form and function as the format argument for the printf function. (For a description of the format and arguments, seeprintf in the Run-Time Library Reference.) A null character is appended to the end of the characters written.

For more information, seesprintf in the Run-Time Library Reference
younggle 2005-05-30
  • 打赏
  • 举报
回复
学习VC不装MSDN就等于近视的人不戴近视眼睛一样,如果你近视了,也可以不戴眼睛啊。
hiiiiiijiang 2005-05-30
  • 打赏
  • 举报
回复
多看点书先。。。还需要半年入门
djfu 2005-05-30
  • 打赏
  • 举报
回复
先装 MSDN ,然后按F1
hjcy_2002 2005-05-30
  • 打赏
  • 举报
回复
不装MSDN当然不可以!无论多么厉害的人物,都需要看MSDN。
比尔盖茨有时候应该也会看看!
leechiyang 2005-05-30
  • 打赏
  • 举报
回复
还是先看书吧,找本最基础的书来看.
现在弄VC是个错误.:p
wu_xiaoer 2005-05-30
  • 打赏
  • 举报
回复
不装MSDN可不可以
FTDS 2005-05-30
  • 打赏
  • 举报
回复
去买个安装盘,装一下,选完全安装,这样就不用光盘了,很大,2G的文本
FTDS 2005-05-30
  • 打赏
  • 举报
回复
里面几乎所有的类,函数都有
FTDS 2005-05-30
  • 打赏
  • 举报
回复
查MSDN呀

16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧