您的位置:首页 > 其它

程序中写数据到文件

2016-03-08 08:08 316 查看
#include <iostream>
#include <iomanip>
#include <fstream>

using std;

//ofstream fout2("/home/robot2/Desktop/wheel_right.txt");

string home_value = getenv("HOME");
string file_path = home_value+"/Desktop/wheel_right.txt";
ofstream fout2(file_path.c_str());//或ofstream fout2; fout2.open(file_path.c_str(),ios::app);

fout2<<twist.linear.x<<" "<< twist.angular.z<<std::endl;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: