Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
asl
Visitor

Working with files

Hello, I'm trying to work with files and the only way I can find is by using the "roByteArray" object and it lacks some basic operations like:

- Truncate a file to a certain size
- Read/Write a text file per lines

Text lines can be manually implemented with ReadFile and WriteFile functions, but what about truncating a file? Is there any other way of working with files besides "roByteArray"? How can I truncate a file at a certain position?

Thanks.
0 Kudos
1 REPLY 1
renojim
Community Streaming Expert

Re: Working with files

To truncate, you have to either read in only the part you're interested in and write it back out or read in the whole file and only write out the part you're interested in.
From ifByteArray:
 ReadFile(path as String, start_index as Integer, length as Integer) As Boolean
 WriteFile(path as String, start_index as Integer, length as Integer) As Boolean

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.