|
help with file I/O on Crio ... unable to read file when fopen fails
Hi
We have an Iterative robot working using the WPIlib in C++ and would like to store floating point values to the cRio for later use. We created a test program that reads and writes a file in windows using standard fopen\fscanf\fprintf\fclose and then ported it to the cRIO.
We've successfully copied a test.txt to the file system using FTP but the fopen for the read routine is failing.
We've tried "c:\\", " /test.txt" or the "file://" and "text.txt" but none have worked. We found a post that mentioned something about a SetFileWriteAllowed but not sure if that is required for reading. I've searched the other forums with some success but haven't found a working sample using the WPIlib. Let me know and I can post the actual code but here is the idea:
//sample ...
FILE *pFile = fopen("text.txt", "rt");
if(pFile == NULL )
{printf("failed to open"); return false;}
fscanf(pFile,"Offset=%f",&floatTest);
//and later we have something similar in order to write using fprintf
fprintf(pOutFile,"\nLabel_1=%d",floatTest);
Any ideas would be appreciated.
Thanks
|