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

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

_dos_creatnew

Syntax

 
#include <dos.h>

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

Description

This is a direct connection to the MS-DOS create unique function call (%ah = 0x5B). This function creates the given file with the given attribute and puts file handle into handle if creating is successful. This function will fail if the specified file exists. 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 also _dos_open, _dos_creat, _dos_read, _dos_write, and _dos_close.

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

Return Value

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

Portability

ANSI/ISO C No
POSIX No

Example

 
int handle;

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

  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004