[Need Help] Printing text to Micro SD Card

Hello, I was wondering if anyone knew how to print text to a Micro SD Cards text file inside of VEXcode Pro V5. I have looked all over, but I cannot get one solid answer, so if somebody will help me that would be so greatly appreciated. Also if there was a way to print to the brain and grab an output file that would be great aswell.

iirc, you can do it using something like:

//Open file
FILE* mytextfile = fopen("filename.txt", "a");

//Print to file
fprintf(mytextfile, "Format string", ...);

//Close file

if you are using a loop, you would want to open the file before the loop and close it after.


This post has some more examples:

1 Like

Thanks for the reply. I put the open file code inside of the top of usercontrol(), then I put the rest inside a button. Can I do this? The error I get is a memory permission error (0304CA62).

It appears that VexCode’s API actually has its own file management system. You should use what weilin linked instead.

Gotcha, I will try it as soon as possible. That code seems to be in vex coding studio instead of vex v5 pro, you think it will still work?

VexCode is based on the VCS API.

VEXcode supports both the slightly simplified API using the Brain.SDcard methods or standard C and C++ APIs using file descriptors and streams.


Thank you all for your help!

1 Like