Troubleshooting Error 8 When Writing to or Reading from a File

Updated Nov 13, 2018

Reported In

Software

  • LabVIEW 7.1.1 Professional
  • LabVIEW Base
  • LabVIEW Professional
  • LabVIEW Full
  • LabVIEW Real-Time Module

Other

Hardware: CD-ROM

Issue Details

Why do I receive a File Permission Error: Error 8 when I try to open a file using a File I/O function? 

Error 8 occurred at an unidentified location
Possible reason(s):
LabVIEW: (Hex 0x8) File permission error. You do not have the correct permissions for the file.


Solution

  1. Open the block diagram of the high-level File I/O function, such as Open/Create/ReplaceFile.VI
  2. Change the open mode input on the Open File.VI to a numeric constant of 1.
    • If you created a constant or a control directly from the input terminal, select the "read-only" option from the drop-down menu.
    • Make the same change if you are using only the Open File.VI and not a high-level File I/O function. 
For other solutions related to Error 8, please see related links below as well as these steps:

Troubleshooting Steps:
  • Check any other open applications - make sure that they close the file before LabVIEW opens it.
  • If you have manually opened the file - make sure you close it before you run your program.
  • If you have made changes to your file structure - ensure you are setting the right directory for your file I/O VI.
  • Ensure that the Windows account has permission to edit the file. If you are editing another account's file, you may not have permission to do so.
  • If you are creating an executable, the source files included that the application is trying to access may be in the wrong directory for the target you are running it on (double check where your Source Files will be placed)
  • If on a Real Time OS, make sure that the Linux Security Shell is not getting in the way and that you are writing/reading to a folder the lvadmin has access to.

Additional Information

Files originating from a non-writable medium such as a CD-ROM are marked as read-only by the operating system. Any high-level File I/O function that uses the Advanced File I/O Open File.vi function with a read-only file will generate a file permission error. For example, the Open/Create/Replace File.VI uses the advanced function, Open File.VI.

The reason for this is due to the open mode input on the Open File.VI. It defaults to a value of zero, which corresponds to "read and write." To open a read-only file, you need to change the open mode input to one (1), which corresponds to "read-only." Otherwise, you will get the file permission error.

WAS THIS ARTICLE HELPFUL?

Not Helpful