View Single Post
  #1   Spotlight this post!  
Unread 28-02-2011, 17:03
Carmello Carmello is offline
Registered User
no team
 
Join Date: Jan 2010
Location: Connecticut
Posts: 5
Carmello is an unknown quantity at this point
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
Reply With Quote