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.

create a file under www/ folder

Other Parts Discussed in Thread: CC3200, UNIFLASH

I would like to write some measurement on a file, named temperature for example, and then make it accessible to other device by the page

http://ip_address/temperature

i was able to write manually a file and flash it on the device under the folder

but i would like that cc3200 creates a file under the folder www/ automatically


is it possible to do it?

  • Hi,

    Yes, it is possible.

    File system APIs are exposed to the application as you can see under fs.c/h.

    Just note that the file system dows not really have directories. It is all flat.

    The name of the file should begin with /www/ prefix but it is not really a directory.

    Shlomi

  • Hi Shlomi.

    Thank you for your answer, but I have another one.

    Do I need to have some permission to write files?

  • Hi,

    Since it is not a secured file system, you do not need a permission.

    Just follow the examples of file_operations in the SDK and you will see how to do it.

    Just open/create, write and close.

    Shlomi

  • I followed the example of file_operations but I got error "invalid file handle" in my application.

    Now I did this way:

    - I flashed a txt file using uniflash
    - using following code I'm able to write the file:

    sl_FsOpen((unsigned char *)USER_FILE_NAME,
    FS_MODE_OPEN_WRITE,
    ulToken,
    lFileHandle);

    sl_FsWrite(*lFileHandle,
    (unsigned int)(sizeof(myText)), // where unsigned char myText[] = "this is my text";
    (unsigned char *)myText, sizeof(myText));

    sl_FsClose(*lFileHandle, 0, 0, 0);


    but I obtain the following result:

    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿthis is my text
  • Hi,

    Please refer to the documentation of sl_FsWrite() API. The 2nd parameter is the offset.

    You are writing to the offset that is set to the length of you string. Is that what you wanted to do or write it from start (offset 0)?

    In any case, just to emphesize that there is no option to append in the file system.

    Openning a file with write attribute would first delete the content. If you want to append you need to manage it from the host.

    Shlomi

  • sure, I didn't change the offset.

    thank you