标题:急~ 大家帮下忙
只看楼主
Waiting_alone
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2008-10-28
 问题点数:0 回复次数:1 
急~ 大家帮下忙
在VC中,CFILE的GetLength()函数可直接得到大小:
CFile cf;
 // Attempt to open thefile for reading.
 if( !cf.Open( pszFilename, CFile::modeRead ) )
  return( FALSE );
 // Get the size of the file and store
 // in a local variable. .
 DWORD dwSize;
 dwDibSize = cf.GetLength();


提示 error C2440: '=' : cannot convert from 'unsigned long (__thiscall CFile::*)(void) const' to 'unsigned long'
        Conversion is a valid standard conversion, which can be performed implicitly or by use of static_cast, C-style cast or function-style cast

为什么呢。。。
搜索更多相关主题的帖子: error·~ 
2008-11-24 10:44
debroa723
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:23
帖 子:862
专家分:1954
注 册:2008-10-12
得分:0 
dwDibSize 写错了吧.
GetLength的返回值是 ULONGLONG,是unsigned __int64
所以要不改dwSize的类型为ULONGLONG,要不强转一下  dwSize = (ULONGLONG)cf.GetLength();
2008-11-24 13:56



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-245954-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.080581 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved