How to write to file when testing robot code?

I’m trying to write to an output file while testing my robot code. However, though the test runs successfully, no file gets created (or, if the file already exists, nothing is written). However, when I try the same thing in a normal C++ file and run it, the output file is created and written to. What am I doing wrong?

FRC main.cpp test code:

Plain (working) C++ code:
Screenshot_20230116_113314

My guess is that the path when running the test isn’t what you expect. Maybe try printing the file’s absolute path?

1 Like

Apparently the file was getting created in the build/test-results/.../debug directory. Thanks!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.