| MIL 10 Reference
| Customize Help
| Save Settings

MappFileOperation



See also
Reference:
Availability
Available in MIL-Lite
Available in MIL

Available on Windows
Available on Linux

Available on Non-Matrox computer
Available on Matrox 4Sight-X
Available on Matrox 4Sight GP
Available on Matrox Supersight
function map Function map
Examples
Synopsis
Perform a file operation on a local or a remote computer.
Syntax
void MappFileOperation(
MIL_ID Comp1ContextAppId, //in
MIL_CONST_TEXT_PTR Comp1FileName, //in
MIL_ID Comp2ContextAppId, //in
MIL_CONST_TEXT_PTR Comp2FileName, //in
MIL_INT64 Operation, //in
MIL_INT64 OperationFlag, //in
void *OperationDataPtr //out
)
Description

This function can copy a file from one computer to another, including your local computer as either source or destination. This function can also remotely delete a file, create or delete a directory, or execute a program on another computer. When executing a program, you can choose to wait for the remotely-run program to finish before proceeding with the local program, or start the remote program and immediately continue with the local program.

This function is typically used to perform operations on remote computers, but also works on the local computer.

Note that this function reference has not been updated for a MIL system added during a MIL update. Refer to the MIL system's release note to see if there is complementary information.
Parameters
This function is not supported on the selected boards.
Parameters
Comp1ContextAppId

Specifies the identifier of the application context to use. The computer that contains this application is referred to as computer 1.

function map For specifying the application context on Computer 1
CollapseValue Description
Collapse M_DEFAULT

Specifies the current (local) application context.

Collapse Application Context Identifier

Specifies the application context identifier.

Typically specifying an application context identifier is used to specify a remote application on a remote computer. However, it can be used for a remote application on the local computer, or the current application. When you explicitly specify the current application, it is equivalent to specifying M_DEFAULT.

(summarize)
Comp1FileName

Specifies the file on the target or source computer to use for the operation.

function map For specifying the file on Computer 1
CollapseValue Description
Collapse MIL_TEXT("FileName") 1

Specifies the file name, and optionally the drive and directory, of the file in the target or source computer to use for the operation. Specifying only the file name assumes that the file is in the working directory of the application. If the file is elsewhere on the target or source computer, a path is required. For example, "myFile" or "C:\myDirectory\myFile".

To specify a file on a remote computer (under Distributed MIL), prefix the specified file name string with "remote:///" (for example, "remote:///C:\myDirectory\myFile").

Optionally, the file name and/or path can be followed by executable arguments (command-line parameters) for the M_FILE_EXECUTE and M_FILE_DISPATCH operations. For example, "C:\myDirectory\myProgram -c -r".

(summarize)

1 If you are passing the value in a variable, don't enclose it in MIL_TEXT().

Comp2ContextAppId

Specifies the destination application in which to copy the file specified using Comp1FileName during the M_FILE_COPY or M_FILE_COPY_MIL_DLL operation. The computer that contains this application is referred to as computer 2.

Note that computer 2 can be the same as computer 1. In other words, the source and destination of the copied file can be different paths on the same computer.

Set this parameter to M_NULL when not in use.

See the Parameter associations section for possible values that can be specified.

Comp2FileName

Specifies the directory (and optionally a new file name) in computer 2 in which to copy the file specified using Comp1FileName.

Set this parameter to M_NULL when not in use.

See the Parameter associations section for possible values that can be specified.

Operation

Specifies the operation to perform on the specified file.

See the Parameter associations section for possible values that can be specified.

OperationFlag

Reserved for future expansion. This parameter must be set to M_DEFAULT.

OperationDataPtr

Specifies the address of the user data that used by some operations. Set this parameter to M_NULL if not used.

See the Parameter associations section for possible values that can be returned.

The table below lists possible values for the Comp2ContextAppId, Comp2FileName, and Operation parameters and possible values returned to the OperationDataPtr parameter.

function map For specifying the operation
CollapseOperation Description
Comp2ContextAppId
Comp2FileName
OperationDataPtr
- Possible values returned
Collapse M_FILE_COPY

Specifies to copy the file from the source computer to the destination computer.

(summarize)
Collapse Comp2ContextAppId

Specifies the application in which to copy the file specified using Comp1FileName. The computer that will receive the copied file is referred to as the destination computer.

(summarize)
Collapse M_DEFAULT

Specifies the current (local) application context.

Collapse Application Context Identifier

Specifies the application context identifier.

Collapse Comp2FileName

Specifies the directory, and optionally a new file name, in the destination computer in which to copy the file specified using Comp1FileName.

(summarize)
Collapse MIL_TEXT("Drive\Path\[FileName]") 1

Specifies the drive, directory, and optionally the new file name, in the destination computer in which the file specified using Comp1FileName will be copied. For example, "C:\myDirectory\" or "C:\myDirectory\myNewFileName".

To specify a file on a remote computer (under Distributed MIL), prefix the specified file name string with "remote:///" (for example, "remote:///C:\myDirectory\myFile").

If no destination file name is specified, the source file name is used.

(summarize)
Collapse OperationDataPtr
Data type info

Data type: M_NULL

Collapse M_FILE_COPY_MIL_DLL

Specifies to copy a user created DLL that contains custom MIL functions from the source computer to the location of the MIL DLLs on the destination computer.

This operation is used to copy custom MIL functions created using the Function Development module (Mfunc...()).

(summarize)
Collapse Comp2ContextAppId

Specifies the application in which to copy the file specified using Comp1FileName. The computer that will receive the copied DLL is referred to as Computer 2.

(summarize)
Collapse M_DEFAULT

Specifies the current (local) application context.

Collapse Application Context Identifier

Specifies the application context identifier.

Collapse Comp2FileName

Specifies to rename the DLL copied to Computer 2. The drive and path are determined based on the location of the MIL DLLs on Computer 2.

To keep the file name specified in Comp1FileName, set this parameter to M_NULL.

(summarize)
Collapse MIL_TEXT("FileName") 1

Specifies a new file name for the copied DLL.

Collapse OperationDataPtr
Data type info

Data type: M_NULL

Collapse M_FILE_DELETE

Specifies to delete the specified file on Computer 1.

(summarize)
Collapse OperationDataPtr
Data type info

Data type: M_NULL

Collapse M_FILE_DELETE_DIR

Specifies to delete a directory on Computer 1. The directory must already be empty.

(summarize)
Collapse OperationDataPtr
Data type info

Data type: M_NULL

Collapse M_FILE_DISPATCH

Specifies to execute the specified program on Computer 1 without waiting for the specified program to terminate on the source computer. When set to M_FILE_DISPATCH, Computer 1 cannot return an exit code.

Note that when set to M_FILE_DISPATCH, the Comp1FileName parameter can include executable arguments (command-line parameters).

(summarize)
Collapse OperationDataPtr
Data type info

Data type: M_NULL

Collapse M_FILE_EXECUTE

Specifies to execute the specified program on Computer 1. The computer initiating the operation will wait for the program to terminate. Optionally, you can retrieve the exit code of the program using OperationDataPtr.

Note that when set to M_FILE_EXECUTE, the Comp1FileName parameter can include executable arguments (command-line parameters).

(summarize)
Collapse OperationDataPtr
Data type info

Data type: M_NULL

Collapse M_FILE_EXISTS

Specifies whether the file passed in Comp1FileName exists on the system specified in Comp1ContextAppId.

(summarize)
Collapse OperationDataPtr
Data type info

Data type: MIL_INT

Returns one of the following.

(summarize)
Collapse M_NO

Specifies that the file does not exist.

Collapse M_YES

Specifies that the file does exist.

Collapse M_FILE_EXISTS_MIL_DLL

Specifies whether the file passed in Comp1FileName exists on the system MIL DLL path specified in Comp1ContextAppId.

(summarize)
Collapse OperationDataPtr
Data type info

Data type: MIL_INT

Returns one of the following.

(summarize)
Collapse M_NO

Specifies that the file does not exist.

Collapse M_YES

Specifies that the file does exist.

Collapse M_FILE_MAKE_DIR

Specifies to create a directory on Computer 1.

(summarize)
Collapse OperationDataPtr
Data type info

Data type: M_NULL

1 If you are passing the value in a variable, don't enclose it in MIL_TEXT().

Compilation information
Header Include mil.h.
Library Use mil.lib.
DLL Requires mil.dll.
DEFAULT FILE COPY DEFAULT FILE COPY MIL DLL DEFAULT FILE DELETE FILE DELETE DIR FILE DISPATCH FILE EXECUTE FILE EXISTS NO YES FILE EXISTS MIL DLL NO YES FILE MAKE DIR