文件
ifstream
在C++中,可以利用ifstream文件输入流,当我们直接使用ifstream来创建文件输入流的时候,如果文件不存在则流创建失败。
ifstream fin("hello.txt"); if (!fin) { std::cout << "can not open this file" << endl; }fstream
fstream _file; _file.open(FILENAME,ios::in); if(!_file) { cout<<FILENAME<<"没有被创建"; } else { cout<<FILENAME<<"已经存在"; }_taccess
Generic-Text Routine Mappings:
| TCHAR.H Routine | _UNICODE & _MBCS Not Defined | _UNICODE Defined | _UNICODE Defined | | _taccess | _access | _access |_waccess |返回值
mode Value Checks File For 00 Existence only 02 Write permission 04 Read permission 06 Read and write permissionExample:
#include <io.h> #include <stdio.h> #include <stdlib.h>