Initializing help system before first use

XPRDfopen

XPRDfopen


Purpose
Open a file on a remote instance.
Synopsis
XPRDfile XPRDfopen(XPRDmosel mosel, const char *fname, int mode, char *errmsg, int msglen);
Arguments
mosel 
Mosel instance
fname 
File name
mode 
Open mode (may be combined):
XPRD_F_BINARY 
Open file in binary mode (default is text mode)
XPRD_F_INPUT 
Open for reading
XPRD_F_OUTPUT 
Empty the file and open it for writing
XPRD_F_APPEND 
Open for writing, appending new data to the end of the file
XPRD_F_LINBUF 
If open for writing, flushes buffer after end of each line
XPRD_F_BSZ(s) 
Set to s kilobytes the size of the communication buffer (default:8, must be between 2 and 64)
errmsg 
Buffer to return error message
msglen 
Size of errmsg
Return value
A file descriptor or NULL in case of failure.
Example
Open file "myfile" located in the temporary directory of instance minst for reading in binary mode:
f=XPRDfopen(minst, "tmp:myfile", XPRD_F_BINARY|XPRD_F_INPUT); 
Further information
1. The specified file path is relative to the working directory of the Mosel instance performing the file operation.
2. File operations are performed under the restrictions of the Mosel instance. For example, if the remote instance does not have write access, this routine will fail to open a file for writing.
3. Just like accessing files from a Mosel model, any I/O drivers supported by the remote instance can be used with this routine. Drivers "sysfd:", "tmp:" and "shmem:" are therefore available.
Related topics