cpubbs论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

LabVIEW+单片机学习套件全套教程资料下载[免费]LabVIEW论坛精华列表贴USB0816数据采集卡《LabVIEW宝典》
LabWindows/CVI论坛精华贴NET0816以太网数据采集卡RC0210远程设备授权系统 关闭关停锁定打开设备 户外分布式数据采集
NET1624低速高精度以太网数据采集卡WIFI0824SD无线WIFI网络数据采集卡脱机运行 SD存储 小尺寸微型 串口采集远程采集 安卓 手持移动采集 纪录仪
查看: 734|回复: 5

判断一个文件是否存在用什么函数啊?

[复制链接]
发表于 2010-5-25 17:10:43 | 显示全部楼层 |阅读模式
我用fopen打开文件路径,if((fp=fopen(路径,r))==NULL),然后运行时提示有错误,应该怎么判断文件存在啊?谢谢帮助一下我 这个小虾
发表于 2010-5-25 20:53:04 | 显示全部楼层
If an error occurs, OpenFile returns –1 and sets the last error status to one of the following values. To get the last error status, call GetFmtIOError.
FmtIOMaxFilesErr    256 files open already.
FmtIOInvalArgErr    Filename is NULL or contains only whitespace.
FmtIOInvalArgErr    Invalid Read/Write Mode, Action, or File Type.
In addition, OpenFile sets the error status to a system–dependent value if an error occurs opening the file. For more information about these values, see the library help.
发表于 2010-5-25 20:53:29 | 显示全部楼层
并不是NULL,而是负值
发表于 2010-5-25 20:53:51 | 显示全部楼层
 楼主| 发表于 2010-5-26 09:27:20 | 显示全部楼层
谢谢各位帮忙
 楼主| 发表于 2010-5-26 10:15:09 | 显示全部楼层
还需要请教一下,用access函数总是出现错误,好像是定义类型错误,为什么啊?帮忙解答一下吧,谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|cpubbs论坛. ( 粤ICP备09171248号 )

GMT+8, 2025-4-19 03:34 , Processed in 0.537665 second(s), 8 queries , Gzip On, File On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表