首页
社区
课程
招聘
[求助]那里有这个MFC的资料
发表于: 2005-7-17 19:17 4288

[求助]那里有这个MFC的资料

2005-7-17 19:17
4288
50                 push eax
0041DAF5   |.  68 0CA74600        push SGUI.0046A70C                             ;  ASCII "%s"
0041DAFA   |.  56                 push esi
0041DAFB   |.  E8 A6610300        call <SGUI.CString::Format(char const *,...)>  ;  jmp to MFC42.#2818

我没有系统的学过VC下编程!
看到这个,不明白了!
请大虾指教!
谢谢!

[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!

收藏
免费 0
支持
分享
最新回复 (3)
雪    币: 270
活跃值: (312)
能力值: ( LV9,RANK:330 )
在线值:
发帖
回帖
粉丝
2
跟c的printf差不多,前面是一个格式化字符,后面是参数,返回CString。具体参照任何一本c的编程书籍
2005-7-17 19:56
0
雪    币: 288
活跃值: (415)
能力值: ( LV9,RANK:290 )
在线值:
发帖
回帖
粉丝
3
下面是从MSDN上面找的,相信楼主也看得懂
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.

Example

CString str;

str.Format(_T("Floating point: %.2f\n"), 12345.12345);
_tprintf("%s", (LPCTSTR) str);

str.Format(_T("Left-justified integer: %.6d\n"), 35);
_tprintf("%s", (LPCTSTR) str);

str.Format(IDS_SCORE, 5, 3);
_tprintf("%s", (LPCTSTR) str);
   

Output

If the application has a string resource with the identifier IDS_SCORE that contains the string "Penguins: %d\nFlyers  : %d\n", the above code fragment produces this output:

Floating point: 12345.12
Left-justified integer: 000035
Penguins: 5
Flyers  : 3
2005-7-17 20:59
0
雪    币: 193
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
谢了,知道!
2005-7-18 07:58
0
游客
登录 | 注册 方可回帖
返回
//