delorie.com/djgpp/doc/libc/libc_601.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

_open

Syntax

 
#include <io.h>

int _open(const char *path, int attrib);

Description

This is a direct connection to the MS-DOS open function call, int 0x21, %ah = 0x3d, on versions of DOS earlier than 7.0. On DOS version 7.0 or later _open calls function int 0x21, %ax = 0x6c00. When long file names are supported, _open calls function 0x716c of Int 0x21.

On FAT32 file systems file sizes up to 2^32-2 are supported. Note that WINDOWS 98 has a bug which only lets you create these big files if LFN is enabled. In plain DOS mode it plainly works.

The file is set to binary mode.

The attrib parameter is a combination of one or more bits from the following:

O_RDONLY
open for read only

O_WRONLY
open for write only

O_RDWR
open for read and write

O_NOINHERIT
file handle is not inherited by child processes

SH_COMPAT
open in compatibility mode

SH_DENYRW
deny requests by other processes to open the file for eaither reading or writing

SH_DENYWR
deny requests to open the file for writing

SH_DENYRD
deny requests to open the file for reading

SH_DENYNO
deny-none mode: allow other processes to open the file if their open mode doesn't conflict with the open mode of this process

This function can be hooked by File System Extensions (see section File System Extensions). If you don't want this, you should use _dos_open (see section _dos_open) (but note that the latter doesn't support long file names).

Return Value

The new file descriptor, else -1 on error.

Portability

ANSI/ISO C No
POSIX No


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004