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.

RTOS/CC3200: file operations

Part Number: CC3200

Tool/software: TI-RTOS

Hey team ,

 I am using simplelink cc3200 launchpad , and i want to store a variable value in a .txt file in the flash using file operation i am able to create a file but when i am reading the value its not getting updated .if i am writing and reading it back its working properly but without writing if i try to read the previous written content its showing no value . Kindly help me with a block of code to store a integer variable value in a txt file and retain it on reset.

char* DeviceFileName = "MyFile.txt";
unsigned long MaxSize = 63 * 1024; //62.5K is max file size
long DeviceFileHandle = -1;
long RetVal; //negative retval is an error
unsigned long Offset = 0;
unsigned char InputBuffer[100];
// Create a file and write data. The file in this example is secured, without signature and with a fail safe commit
RetVal = sl_FsOpen((unsigned char *)DeviceFileName,
FS_MODE_OPEN_CREATE(MaxSize , _FS_FILE_OPEN_FLAG_NO_SIGNATURE_TEST | _FS_FILE_OPEN_FLAG_COMMIT ),
NULL, &DeviceFileHandle);
Offset = 0;
//Preferred in secure file that the Offset and the length will be aligned to 16 bytes.
RetVal = sl_FsWrite( DeviceFileHandle, Offset, (unsigned char *)"HelloWorld", strlen("HelloWorld"));
RetVal = sl_FsClose(DeviceFileHandle, NULL, NULL , 0);
// open the same file for read, using the Token we got from the creation procedure above
RetVal = sl_FsOpen((unsigned char *)DeviceFileName,
FS_MODE_OPEN_READ,
NULL, &DeviceFileHandle);
Offset = 0;
RetVal = sl_FsRead( DeviceFileHandle, Offset, (unsigned char *)InputBuffer, strlen("HelloWorld"));
RetVal = sl_FsClose(DeviceFileHandle, NULL, NULL , 0);

=========the above is working ==============

RetVal = sl_FsOpen((unsigned char *)DeviceFileName,
FS_MODE_OPEN_READ,
NULL, &DeviceFileHandle);
Offset = 0;
RetVal = sl_FsRead( DeviceFileHandle, Offset, (unsigned char *)InputBuffer, strlen("HelloWorld"));
RetVal = sl_FsClose(DeviceFileHandle, NULL, NULL , 0);


System_printf("\r\buffer content is value %s \r\n",InputBuffer);System_flush();

====simply opening the file and reading the content is not giving any output on console.

with regards 

pranav