FMOpen (LabVIEW Manager Function)

MgErr FMOpen(fdp, path, openMode, denyMode);

Purpose

Opens a file with the name and location specified by path for writing and reading, as specified by openMode.

You can use denyMode to control concurrent access to the file from within LabVIEW.

If the function opens the file, the resulting file descriptor is stored in the address referred to by fdp. If an error occurs, the function stores 0 in the address referred to by fdp and returns an error.

Note  Before you call this function, ensure that you understand how to use pointers as parameters.

Parameters

Name Type Description
fdp File * Address at which FMOpen stores the file descriptor for the new file. If FMOpen fails, it stores 0 in the address fdp. This parameter is a pointer.
path Path Path of the file you want to create.
openMode int32 Access mode to use in opening the file. The following values are defined in the file extcode.h.
  • openReadOnly—Open for reading.
  • openWriteOnly—Open for writing; file is not truncated (data is not removed). On Mac OS X, this mode provides true write-only access to files. On Windows or Linux, LabVIEW I/O functions are built in the C standard I/O library, with which you have write-only access to a file only if you are truncating the file or making the access append-only. Therefore, this mode actually allows both read and write access to files on Windows or Linux.
  • openReadWrite—Open for both reading and writing.
  • openWriteOnlyTruncate—Open for writing; truncates the file.
denyMode int32 Mode that determines what level of concurrent access to the file is allowed. The following values are defined in the file extcode.h.
  • denyReadWrite—Prevents others from reading from and writing to the file while it is open.
  • denyWriteOnly—Prevents others from writing to the file only while it is open.
  • denyNeither—Allows others to read from and write to the file while it is open.

Return Value

MgErr, which can contain the following errors. If you receive errors from LabVIEW Manager functions, most error names correspond to LabVIEW error codes.

Value Corresponding Error Code or Description
noErrNo error.
mgArgErr1
fIsOpen5. This error is returned only on Mac OS X. Windows returns fIOErr.
fIOErr6
fNotFound7
fTMFOpen11