Write to a file from a C++ ROS node?
Hello,
Is there a way to write to a file from the C++ source of a ROS node? I know that I can write directly to a .bag file, however I would like to be able to write to my own file formats (i.e. directly to a CSV rather than having to export a CSV from rxbag, etc).
I tried this from within the C++ of a node:
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile.close();
With the above code, the program executes just fine but I can't find "example.txt" anywhere on the file system. Does ROS just ignore this operation, or put the file somewhere I can't seem to find?
Thanks for the help!