fstream创建文件失败,无法创建

string filename1 = "4.1.texture.vs";
fstream file1(filename1, fstream::in | fstream::out | fstream::binary);
if (!file1.is_open()) {
cout << "FileSystem Init failed" << endl;
}
else {
cout << "FileSystem Init Success" << endl;
}
file1.close();

    string filename2 = "4.1.texture.fs";
    fstream file2(filename2, fstream::in | fstream::out | fstream::binary);
    if (!file2.is_open()) {
    cout << "FileSystem Init failed" << endl;
    } 
    else {
    cout << "FileSystem Init Success" <<   endl;
    }
    file2.close();

    opengl创建着色器类的时候,想要在着色器类中新建两个着色器文件,运行时候报错![图片说明](https://img-ask.csdn.net/upload/201908/17/1566006113_951008.png)不知道问题出在哪里

问这种问题需要把相关的背景条件都发出来。首先你问的是程序,就要把程序调成别人可以看的格式,放在“代码片”里,并且把程序运行结果发出来。
其次你问的是文件打开失败,就应该把目录结构发出来。再者,你的问题是文件打不开,问什么下文要提到着色器类,不相关的东西不要说,把问题简明扼要的描述清楚。
图片说明

读取用ifstream,写用ofstream,读取要求文件必须存在,写入会在文件不存在时创建文件,你同时使用读和写,可能出现冲突了