From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
06-08-2016 10:27 AM
Hello everyone,
The issue I am getting is the folowing:
I would like to add to an already existing .txt file other data. To do so, I am using "Set File position" function to determine the current file mark. This function accepts as an input ONLY a refnum!!!
but in my case I just have a path file ( not a refnum !!) . How can I generate from the path I have, a refnum to use it as an input for the "Set File position" function ?
N.B.: Please read the comments in the VI 🙂
Thanks in advance for any help you can provide,
regards,
F
Solved! Go to Solution.
06-08-2016 10:44 AM
If your file exists, you have to open it....
06-08-2016 11:04 AM
Use the Build Path function instead of all the string concatenation and the string to path function.
06-08-2016 11:15 AM
Well, it makes no sense to set the file position on a file that is not even open. So open the file first.
And since you are adding data to the end of the text file, set the file position relative to End instead of Current (and Current will be 0 when you first open the file).
06-09-2016 03:53 AM
The OS does not maintain a file pointer for a file that automagically gets reused when you open a file. You have to open the file, set the file pointer on that open file reference, do your write and/or read operation and then close the file. Once you close the file the file pointer that was maintained for that file in that file reference is lost and when you open the file again it opens with a new file pointer initialized to the beginning of the file.
And changing Windows and LabVIEW to make it work as you would like is not an option, so you have to change what you do.
06-09-2016 07:32 AM
I tried yesterday to open it before writing on it, but I got the1059 error !
But now it is working! weird!
Thanks