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.

CC3200 any File exist API



Hello,

I used sl_FsWrite() API to write to one file and then  sl_FsRead() for reading a existing file.

But,
I want to check whether my file is exist or not.
or
Is file is exist check for a blank file or any information file contains(i.e. check file size API).

Is there is any API?

Regards,

Prajakta

  • Prajakta,

    Have you tried sl_FsGetInfo? It returns a struct SlFsFileInfo_t object which contains the file size. I would expect if the file does not exist, then it returns an error code. Using this, you could determine if the file exists and its size.

    You could also use sl_FsRead. If it returns error, then the file does not exist. If it exists, then read the first part looking for a special token of your choice. If that fails, then the file should be overwritten. If you get back your special token, then you have good data.

    ~Ramsey