Hoyer

Write a txt file additively

Recommended Posts

Hi,

I would like to write data into a txt file every time a given event occurs, which I would like to investigate later.

So I want new data to be written into the same txt file, into a new row without overwriting previous data.

How can I do that?

Thank you in advance!

Share this post


Link to post
Share on other sites

You could use an export set, or if you want real control over the file format, use the low level file functions.  For example:

private handle = file.open("c:\data\myfile.txt",0,1,1,1)
file.write(handle, "Here is some data:" + myChannel[0])
file.close(handle)

The Logging part of the user's guide has the description of all the file. functions.  Those 0's and 1's in open correspond to: Read, Write, Append, Text, so what I have in the example is not to read, but to write; to append and not overwrite data, and that I'm writing a text file (which means it generates a new line with every call to write())

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now