append to text file

2540
2
08-13-2015 07:22 PM
by Anonymous User
Not applicable

Might be a simple question.... in the QML extras there is the FileFolder object, which has methods to write to file or text files. But they seem to just overwrite any existing file - is there a way to append instead?

FileFolder{

id: myfileFolder

path: "c:/myfolder"

}

myfileFolder.writeTextFile("myFile.txt", "my message to add")

myfileFolder.writeFile("myFile.txt", "my message to add")

0 Kudos
2 Replies
ChrisSmith7
Frequent Contributor

Paul,

I am not familiar with QML, but saw you hadn't received a response, yet. I perused the API reference - ArcGIS Runtime QML Extras: FileFolder Class Reference - but couldn't see anything that natively supported appending to the file. This is a really basic feature - I'm surprised it's not something made available to you.

As an alternative, how about reading the existing text file using the readTextFile​ method, appending it yourself, then calling the writeTextFile method with the full string object?

by Anonymous User
Not applicable

Hi Chris - yes, reading, adding to and then re-writing the whole file seems to be the solution in the absence of an append method.

Cheers,

-Paul

0 Kudos