02-07-2020 07:41 AM - edited 02-07-2020 07:41 AM
Hi ayscr,
@ayscr wrote:
Hi johntrich,
I have an older version of Labview (2011) and can't open this.
P.S.: It sounds like your version of Labview allows you to feed a refnum into the Read From Binary File function, which mine doesn't
Even LV2011 allowed to use file refnums for ReadBinaryFile as can be seen here:
02-07-2020 07:45 AM
Thanks all for your replies, with the refnum (where it asks for a path in 2011) and the file open and close outside the loop it works!
02-07-2020 10:15 AM
I apologize for not paying attention to the version you posted. I know you got to the solution but I attached a 2011 version of my edits. I got rid of your sequence structure and cleaned up the code a little also.
02-08-2020 10:34 AM
Hi ayscr,
You probably already figured this out, but Read (and Write) from(to) Text File are some special sort of polymorphic.
If you read the detailed help for Read from Text File, you see the following description for the file input:
| file can be a refnum or absolute file path. If it is a path, this function opens the file specified by the path. The default is to display a file dialog box and prompt you to select a file. |
Generally when you want to use a file more than once, it's better to open the file (with Open/Create/Replace File) and close it (with Close File) separately, and just keep the reference (often with a Shift Register or in a class' private data, or similar).