To perform I/O operations on a new or existing file, an application must first establish a connection by calling the mmioOpen function. This returns a file handle, which identifies the open file when calling other file I/O functions. Specify the pmmioinfo parameter to identify a pointer to a caller-provided MMIOINFO block containing extra parameters used by mmioOpen. pmmioinfo may be NULL if the default values of the fields of pmmioinfo are sufficient. By specifying an MMIOINFO structure, you can open a memory file, specify a file format I/O procedure, supply a buffer, or specify data transfers in a standard presentation format. For basic file I/O services, set pmmioinfo to NULL. For example, the following code sample shows how to open a data file without a buffer.

hmmio = mmioOpen("filename.ext", NULL, 0);

Basic options for mmioOpen are shown in the following table.

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Flag                          ³Description                   ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³MMIO_ALLOCBUF                 ³System allocates an internal  ³
³                              ³I/O buffer.                   ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³MMIO_APPEND                   ³Allows appending to the end of³
³                              ³a file.                       ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³MMIO_BUFSHARED                ³Uses shared memory if MMIO    ³
³                              ³allocates an I/O buffer.      ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³MMIO_CREATE                   ³Creates a new file.           ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³MMIO_DELETE                   ³Deletes the file if it already³
³                              ³exists.                       ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³MMIO_NOIDENTIFY               ³Does not attempt to identify  ³
³                              ³the file type.                ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³MMIO_READ                     ³Opens a file for reading only ³
³                              ³(default).                    ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³MMIO_READWRITE                ³Opens a file for both reading ³
³                              ³and writing.                  ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³MMIO_VERTBAR                  ³Uses the vertical bar         ³
³                              ³character (|) as a file       ³
³                              ³separator character rather    ³
³                              ³than the plus sign (+).       ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³MMIO_WRITE                    ³Opens a file for writing only.³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ

The following example creates a new file named NEW.TXT and opens it for writing:

hmmio = mmioOpen("NEW.TXT", NULL, MMIO_CREATE | MMIO_WRITE);

You can also use mmioOpen to specify sharing options for data files. These options enable DOS files to be opened and accessed by more than one process, allowing an application to take advantage of the multi-processing feature of the OS/2 operating system.

Sharing options for data files are shown in the following table.

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Flag           ³Description                                  ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³MMIO_DENYNONE  ³Opens a file without denying other processes ³
³               ³read or write access to the file.            ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³MMIO_DENYREAD  ³Opens a file and denies other processes read ³
³               ³access to the file.                          ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³MMIO_DENYWRITE ³Opens a file and denies other processes write³
³               ³access to the file.                          ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³MMIO_EXCLUSIVE ³Opens a file with exclusive mode, denying    ³
³               ³other processes both read and write access to³
³               ³the file.                                    ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ


[Back] [Next]