Forum Discussion

ogai_p's avatar
ogai_p
Visitor
14 years ago

How to write using WriteAsciiFile?

Hi,

Using this function writes to a temporary file that disappears when my channel is closed:
WriteAsciiFile("tmp:/config.txt", "the text to write")

What filepath should I use so that the data I write still exists once my channel is closed then reopened?

Thanks in advance!

4 Replies

  • "ogai_p" wrote:
    Hi,

    Using this function writes to a temporary file that disappears when my channel is closed:
    WriteAsciiFile("tmp:/config.txt", "the text to write")

    What filepath should I use so that the data I write still exists once my channel is closed then reopened?

    Thanks in advance!
    You can't write anything permanent to the filesystem(s) on Roku. You can store data in the registry. See roRegistry and roRegistrySection entries in the Component Reference pdf of the sdk. You can store a max of 16KB data. Once you store data into the registry it persists until you overwrite it, the channel is removed by the user, or the player is reset to factory defaults.
  • destruk's avatar
    destruk
    Streaming Star
    For persistent extra storage, you can write a file like you're doing, and save it off to a web server. However, there is no way to check for a home button press when the channel exits - so you can't count on the data being saved 100%. It's annoying to not have a clean program termination or time to do housekeeping prior to that condition.
  • "destruk" wrote:
    For persistent extra storage, you can write a file like you're doing, and save it off to a web server. However, there is no way to check for a home button press when the channel exits - so you can't count on the data being saved 100%. It's annoying to not have a clean program termination or time to do housekeeping prior to that condition.

    They used to have that functionality prior to firmware 2.6, but changed it to prevent poorly written channels from locking up the box: viewtopic.php?f=34&t=28472&p=179882#p179882
  • destruk's avatar
    destruk
    Streaming Star
    Yeah I remember - but since every public channel must be approved for public consumption, they 'could' change it back. And channels still lock up the box due to internal and secondary bugs with channel code and components, so .... I'm looking at you HULU! HA...