This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-CC3235SF: File Open for Write, then Read (error code -10329)

Part Number: LAUNCHXL-CC3235SF

Hello,

I am really in a quandary regarding opening a file for write, then reading.  First, I open the file for write (which already exists in the filesystem):

data_file_handle = sl_FsOpen((uint8_t *) DATA_FILENAME, (uint32_t) SL_FS_WRITE, &data_file_token);

But, when go to read it, sl_FsRead returns with error -10329:

retval = sl_FsRead(data_file_handle, 0, data_start_ptr, sizeof(user_data));  

This error means "SL_ERROR_FS_FILE_ACCESS_IS_DIFFERENT".

Does anyone have any idea that that error is referring to?

Thanks very much!

  • Hi,

    No this is not possible. When you want to read from file, you should open it for read. Same it is for write. Detail informations about filesytem APIs you find at SWRU455.

    Jan

  • That is brilliant, thank you.  My eyes were glazing over looking through SWRU455.  You made it quite clear:

    1) For read, open the file for reading, then use sl_FsRead to read it.  Then close.

    2) For write, open the file for writing, then use sl_FsWrite to write the data.  Then close.

    For writing, I open with SL_FS_CREATE | SL_FS_OVERWRITE so that it creates the file if it does not already exist.

    Many thanks!  Onward.