Xcode输出到文件失效

cpp 复制代码
#include <iostream>
#include <fstream>

using namespace std;

int main() {
double myNumber = 42.5;
fstream outfile("test.txt", fstream::out);
outfile << "The answer is almost " << myNumber << endl;
outfile.close();
}

运行之后未能找到相应的test.txt文件

解决:

选择顶栏中的Product->Scheme->Edit Scheme->Options->Working Directory勾选Use custom working directory->下面的地址栏选择项目地址。

相关推荐
聚客AI15 小时前
🙋‍♀️Transformer训练与推理全流程:从输入处理到输出生成
人工智能·算法·llm
大怪v18 小时前
前端:人工智能?我也会啊!来个花活,😎😎😎“自动驾驶”整起!
前端·javascript·算法
惯导马工20 小时前
【论文导读】ORB-SLAM3:An Accurate Open-Source Library for Visual, Visual-Inertial and
深度学习·算法
大熊猫侯佩21 小时前
桃花岛 Xcode 构建秘籍:Swift 中的 “Feature Flags” 心法
app·xcode·swift
骑自行车的码农21 小时前
【React用到的一些算法】游标和栈
算法·react.js
博笙困了21 小时前
AcWing学习——双指针算法
c++·算法
悄然林静21 小时前
Mac终端执行`brew doctor`报`openssl@1.1`警告
mac·xcode·apple
moonlifesudo1 天前
322:零钱兑换(三种方法)
算法
权咚2 天前
阿权的开发经验小集
git·ios·xcode
NAGNIP2 天前
大模型框架性能优化策略:延迟、吞吐量与成本权衡
算法