检查C ++中是否存在文件 [英] Checking to see if a file exists in C++

查看:73
本文介绍了检查C ++中是否存在文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个bmp文件,并将其存储在某个目录中。但它无法正常工作。它说该文件即使存在也不存在。谁知道我哪里出错了?



FILE * pfile;

pfile = fopen(C:\Users\me\Test-Outputs \Capture Output \test.txt,r);

I create a bmp file, and store it in a certain directory.But it's not working. It says the file does not exist even though it does. Anyone know where I'm going wrong?

FILE *pfile;
pfile = fopen("C:\Users\me\Test-Outputs\Capture Output\test.txt", "r");

推荐答案

bmp文件或txt文件?



如果你的文件是bmp文件

bmp file or txt file?

if your file is bmp file
pfile = fopen("C:\\Users\\me\\Test-Outputs\\Capture Output\\test.bmp", "r");



如果你的文件是txt文件


and if your file is txt file

pfile = fopen("C:\\Users\\me\\Test-Outputs\\Capture Output\\test.txt", "r");


这篇关于检查C ++中是否存在文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆