Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
asl
Level 7

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