DWORD a;
CString str;
如何将str的值赋给a呀?
CString str;
如何将str的值赋给a呀?
解决方案 »
- vs2008MFC使用MSChart
- 怪事!窗口右边、下面不能调大小
- GetProcAddress函数返回值总为null?
- 各位大虾,一个简单小问题帮帮忙,谢谢!
- 高分求Http Tunnel穿透防火墙的代码
- 大家分配内存的时候,用的是malloc呢还是GlobalAlloc?
- 画图不可以用wm_erasebkgound吗?
- NickTang谢谢您的源代码!这是我承诺给您的分!!!请收下!!!!(怪事,为什么不允许給500分?)所以我发了两个贴子!这是之三
- 求助一个有关数据库的问题!50多万行记录在listbox如何显示?
- vc6的代码能在vc.net上直接编译吗
- CListBox的右键点击问题
- 编辑框读取字符串时自动换行的问题
double d = atof(str);
* as strings can be converted to numeric values
* using the atof, atoi, and atol functions.
*/#include <stdlib.h>
#include <stdio.h>void main( void )
{
char *s; double x; int i; long l; s = " -2309.12E-15"; /* Test of atof */
x = atof( s );
printf( "atof test: ASCII string: %s\tfloat: %e\n", s, x ); s = "7.8912654773d210"; /* Test of atof */
x = atof( s );
printf( "atof test: ASCII string: %s\tfloat: %e\n", s, x ); s = " -9885 pigs"; /* Test of atoi */
i = atoi( s );
printf( "atoi test: ASCII string: %s\t\tinteger: %d\n", s, i ); s = "98854 dollars"; /* Test of atol */
l = atol( s );
printf( "atol test: ASCII string: %s\t\tlong: %ld\n", s, l );
}
Outputatof test: ASCII string: -2309.12E-15 float: -2.309120e-012
atof test: ASCII string: 7.8912654773d210 float: 7.891265e+210
atoi test: ASCII string: -9885 pigs integer: -9885
atol test: ASCII string: 98854 dollars long: 98854
你的指的是将str的地址赋给a吗,还是str内的字符串地址? CString str="ok";
DWORD dwcs,dwstr;
//str内的字符串地址赋给 a
dwstr = (DWORD)str.GetBuffer(str.GetLength());
//str 的地址赋值给a
dwcs = (DWORD)&str; str.Format("%d-%d",dwcs,dwok);
AfxMessageBox(str);
x = atof( s );
printf( "atof test: ASCII string: %s\tfloat: %e\n", s, x ); s = "7.8912654773d210"; /* Test of atof */
x = atof( s );
printf( "atof test: ASCII string: %s\tfloat: %e\n", s, x ); s = " -9885 pigs"; /* Test of atoi */
i = atoi( s );
printf( "atoi test: ASCII string: %s\t\tinteger: %d\n", s, i ); s = "98854 dollars"; /* Test of atol */
l = atol( s );
printf( "atol test: ASCII string: %s\t\tlong: %ld\n", s, l );