Go to the first, previous, next, last section, table of contents.


_dos_creat

Syntax

#include <dos.h>

unsigned int _dos_creat(const char *filename, unsigned short attr, int *handle);

Description

This is a direct connection to the MS-DOS creat function call (%ah = 0x3C). This function creates the given file with the given attribute and puts file handle into handle if creating is successful. If the file already exists it truncates the file to zero length. Meaning of attr parameter is the following:

_A_NORMAL (0x00)
Normal file (no read/write restrictions)
_A_RDONLY (0x01)
Read only file
_A_HIDDEN (0x02)
Hidden file
_A_SYSTEM (0x04)
System file
_A_ARCH (0x20)
Archive file

See section _dos_open. See section _dos_creatnew. See section _dos_read. See section _dos_write. See section _dos_close

This function does not support long filenames, even on systems where the LFN API (see section _use_lfn) is available. For LFN-aware functions with similar functionality see section _creat, and section _creatnew. Also see section creat, and section open, which are Posix-standard.

Return Value

Returns 0 if successful or DOS error code on error (and sets errno)

Portability

not ANSI, not POSIX

Example

int handle;

if ( !_dos_creat("FOO.DAT", _A_ARCH, &handle) )
   puts("Creating was successful !");


Go to the first, previous, next, last section, table of contents.