VEX C++ Pro - How Do I load SD files?

In my SD card, I have the program DeltaIVMain.vex, and I am trying to get the brain to start running the file with a program downloaded in the brain. I am really confused with how to load the files, but I think it’s possible. Also, would it be possible to create a file with a program file and save the file, loading the file, and overwriting the file? If so, how would I be able to do such? With these file systems, would it also be possible to have an auton picker that permanently saves information regardless if the V5 brain shuts off?
Thank you so much for your time :slight_smile:

You cannot run programs from an SD card, the .vex file wouldn’t have the necessary binary image anyway. The SD card can be used for storing or loading any data you would like, so yes, it could be used to save the auton you have selected. Look in the API for sdcard::loadfile and sdcard::savefile or use standard C file access.

Thank you :slight_smile:

There are two things you want here.
One is you want to open and run a user program from the sd card.
The other is you want to save the auton state to a file so the robot can remember it through restarts.
The second is much more feasible than the first.

The first is not possible, as a .vex file is simply the source code.
VCS hides this, but there is a large step between the source code and the robot.
That step is the compiler, which takes your files, checks for errors, and then converts the source code into a .bin machine code executable.
Therefore, it is impossible for the robot to run a .vex file, as there is no compiler on the robot.
If there is a way, it would be to load and run the .bin file. But I do not think that is possible with VCS, maybe with PROS.

For the second thing you want to do, all I can say is read C io tutorials and the VCS api.