Forum Discussion

asl's avatar
asl
Visitor
6 years ago

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.

1 Reply

  • renojim's avatar
    renojim
    Community Streaming Expert
    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