c++ - Ofstream does not write in file
问题描述
I have problem with ofstream. I have program, whitch must write in file info (langulange settings). If i start with VS 2019 Debug or Release all is OK, but whith installer ofstream does not want to work. After installing program read from file, but dont want to write. Can you help?
int langulange = 1;
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main(int argc, char* argv[]) {
ifstream file("config.txt");
if (!file.is_open()) {
ofstream out("config.txt");
out << langulange;
out.close();
return 0;
}
}
解决方案
推荐阅读
- javascript - 验证谷歌recapcha客户端javascript
- python - 如何使用 python 脚本执行多个 spark-submit 命令
- r - 在 R 中均匀间隔地采样随机行
- reactjs - 在 React 中向窗口添加事件侦听器的正确方法是什么?
- c - 为什么在打印语法之前终止 For 循环后显示“Hello”需要更长的时间?
- android - FirebaseRecyclerOptions 与微调器 onItemSelected 查询问题
- c# - 责任链和泛型
- heroku - 使用 Heroku 部署应用程序时无法安装 Pycairo
- ios - FirebaseUI authUI 回调未在电子邮件/通过注册时调用
- notepad++ - 有没有办法在 Notepad++ 64 位中不区分大小写?