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

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

问题描述

我创建了一个文件,一个 bmp 文件,并将其存储在某个目录中.我要检查的是它在那里之后(因此创建是否成功).我有

I create a file, a bmp file, and store it in a certain directory. What I want to check is that it is there after (so whether the creation was successful). I have

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

if(pfile != NULL)
    worked!
else 
    didnt work!!

但它不起作用.它说该文件不存在,即使它存在.有谁知道我哪里出错了?

But it's not working. It says the file does not exist even though it does. Anyone know where I'm going wrong?

推荐答案

使用双反斜杠.单个反斜杠是 C 和类 C 语言中的转义字符.

Use double backslashes. The single backslash is an escape char in C and C-like languages.

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

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