TradeMUX SDK Documentation  1.0
TradeMUX SDK Documentation
int FileOpen ( string  filename,
int  open_flags,
char  delimiter = ';',
uint  codepage = CP_ACP 
)

Opens the file with the specified name and flag

Parameters
filenameThe name of the file (can contain subfolders)
open_flagsСombination of flags determining the operation mode for the file. The flags are defined as follows:

Identifier

Value

Description

FILE_READ

1

File is opened for reading. Flag is used in FileOpen(). When opening a file specification of FILE_WRITE
and/or FILE_READ is required.

FILE_WRITE

2

File is opened for writing. Flag is used in FileOpen(). When opening a file specification of FILE_WRITE
and/or FILE_READ is required.

FILE_BIN

4

Binary read/write mode (without string to string conversion). Flag is used in FileOpen()

FILE_CSV

8

CSV file (all its elements are converted to strings of the appropriate type, unicode or ansi, and separated
by separator). Flag is used in FileOpen()

FILE_TXT

16

Simple text file (the same as csv file, but without taking into account the separators). Flag is used in
 FileOpen()

FILE_ANSI

32

Strings of ANSI type (one byte symbols). Flag is used in FileOpen()

FILE_UNICODE

64

Strings of UNICODE type (two byte symbols). Flag is used in FileOpen()

FILE_SHARE_READ

128

Shared access for reading from several programs. Flag is used in FileOpen(), but it does not replace
the necessity to indicate FILE_WRITE and/or the FILE_READ flag when opening a file.

FILE_SHARE_WRITE

256

Shared access for writing from several programs. Flag is used in FileOpen(), but it does not replace
the necessity to indicate FILE_WRITE and/or the FILE_READ flag when opening a file.

FILE_REWRITE

512

Possibility for the file rewrite using functions FileCopy() and FileMove(). The file should exist or
should be opened for writing, otherwise the file will not be opened.

FILE_COMMON

4096

The file path in the common folder of all client terminals . Flag is used in FileOpen(),
 FileCopy(), FileMove() and in FileIsExist() functions.

Parameters
delimiterValue to be used as a separator in txt or csv-file. If the csv-file delimiter is not specified, the default delimiter is ";". If the txt-file delimiter is not specified, then no separator is used.
If the separator is clearly set to 0, then no separator is used.
codepageReserved
Returns
If a file has been opened successfully, the function returns the file handle, which is then used to access the file data.
In case of failure returns INVALID_HANDLE

"Named pipes" can be opened according to the following rules:
Pipe name is a string, which should have the following look: "\\servername\pipe\pipename", where servername - server name in the network,
while pipename is a pipe name. If the pipes are used on the same computer, the server name can be omitted but a point should be inserted
instead of it: "\\.\pipe\pipename". A client trying to connect the pipe should know its name.
FileFlush() and FileSeek() should be called to the beginning of a file between sequential operations of reading from the pipe and writing to it.
A special symbol '\' is used in shown strings. Therefore, '\' should be doubled when writing a name in application. It means that the above example
should have the following look in the code: "\\\\servername\\pipe\\pipename".