首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

fopen_s,无法打开文件,该如何解决

2012-06-01 
fopen_s,无法打开文件一个控制台应用程序,szFileName参数正常,执行fopen_s后,返回0,但fp无效,查找网络资料

fopen_s,无法打开文件
一个控制台应用程序,szFileName参数正常,执行fopen_s后,返回0,但fp无效,
查找网络资料,也没有查到类似的情况,请大家支招
FILE *fp;

if(fopen_s(&fp,szFileName,"rb")!=NOERROR)
return false;
------------------------
fopen_s 返回0int
fp0x10311448 {_ptr=0x00000000 <错误的指针> _cnt=0 _base=0x00000000 <错误的指针> ...}_iobuf *



[解决办法]
你的盘符是网络映射盘符?

fopen_s will accept paths that are valid on the file system at the point of execution; UNC paths and paths involving mapped network drives are accepted by fopen_s as long as the system executing the code has access to the share or mapped network drive at the time of execution. Special care must be taken when constructing paths for fopen_s to avoid making assumptions about available drives, paths or network shares in the execution environment.

热点排行