SITL Gazebo: Get data to .txt file


I am running the PX4 simulation with SITL Gazebo and trying to store my data in a .txt file. I added the following lines for a simple tryout:

FILE *fp;
fp = fopen("test.txt", "w+");
fprintf(fp, "This is testing for fprintf...\n");
fputs("This is testing for fputs...\n", fp);

It compiles without erros. The problem is that the programm doesn’t create a test.txt file. I fear this happens since I start the C++ program in SITL. Does anyone has an Idea how do I can solve this problem?


Are you sure that it doesn’t create your file?

Once you compile for SITL a “build_posix_sitl_default” folder is created. Did you check inside that folder (including the subfolders)?

Hi, yes I checked inside that folder including the subfolders. The .txt has not been created. Do you have any suggestion why?