GX5296, GX5961, GX5964, File
Opens or creates a file for later access by File API functions.
GtDio6xFileOpen (szFileName, nMode, phFile, nFileBoardType, pnStatus)
Name |
Type |
Comments |
szFileName |
PSTR |
Pointer to a null-terminated string that specifies the name of the DIO6X file to create or open. |
nMode |
SHORT |
Specifies the type of access requested for the file, as follows:0. GTDIO6X_FILE_READ: Read only. If the file does not exist or cannot be found the function call fails. 1. GTDIO6X_FILE_READ_WRITE: Read and Write. The file must exist. 2. GTDIO6X_FILE_CREATE: Create, opens an empty file for both reading and writing (see Comments). |
nFileBoardType |
SHORT |
In case nMode = GTDIO6X_FILE_CREATE, the user needs to specify the file board type as follows:0. GTDIO6X_FILE_BOARD_TYPE_GX5296: file board type is the GX5296 family. 1. GTDIO6X_FILE_BOARD_TYPE_GX5960: file board type is the GX5960 family. |
phFile |
PSHORT |
Returns a handle for later reference with this file (0 for error). The handle is the file board. |
pnStatus |
PSHORT |
Returned status: 0 on success, negative value on failure. |
This function will open an existing file (if the path is found) or create a new file if the file does not exist depending on the nMode selected.
Calling this function with GTDIO6X_FILE_READ as the nMode will protect any data in the file from being altered. Any function that attempts to modify a file setting, opened with this mode, will return an error status.
Calling this function with GTDIO6X_FILE_READ_WRITE as the nMode will allow the user to modify file settings and then write the contents to disk by calling GtDio6xFileClose.
Calling this function with GTDIO6X_FILE_CREATE as the nMode will delete any existing file (if found) and create a new file. In this case the user should call GtDio6xFileSetChannelCount and GtDio6xFileSetStepCount before calling other file API functions to initialize the file object with the appropriate number of Channels and Steps.
The following example creates a new file with a board type as GX5960, sets the Channel count to 64 and Step Count to 2 and fills the vector memory with a clock vector:
SHORT nStatus;
GtDio6xFileOpen(“C:\\MyFile.dio6x”, GTDIO6X_FILE_CREATE, &hFile, GTDIO6X_FILE_BOARD_TYPE_GX5960, &nStatus);
GtDio6xFileSetChannelCount(nFileHandle, 64, &nStatus);
GtDio6xFileSetStepCount(nFileHandle, 2, &nStatus);
GtDio6xFillVectors(nFileHandle, 64, alChannelListArray, 0, 100, GTDIO6X_FILL_VECTORS_CLOCK, 'h', 'l', &nStatus);
GtDio6xFileClose(hFile, &nStatus);
GtDio6xFileAppend, GtDio6xFileClose, GtDio6xFileImport, GtDio6xFileSetChannelCount, GtDio6xFileSetTimingBoardCount, GtDio6xFileLoad, GtDio6xFileSave, GtDio6xGetErrorString