Write a txt file additively


Hoyer

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!

Link to comment
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())

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.