Your Digital Media Has Never Looked So Good

 
asl
Topic Author
Posts: 1
Joined: Thu Jul 25, 2019 7:19 am

Working with files

Thu Aug 08, 2019 2:36 am

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.
 
renojim
** Valued Community Member **
Posts: 3481
Joined: Mon Feb 15, 2010 1:35 pm

Re: Working with files

Thu Aug 08, 2019 12:18 pm

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

Who is online

Users browsing this forum: No registered users and 6 guests