_lcreat

Syntax

int _lcreat(lpPathName,iAttribute)

This function opens a file with the name specified by the lpPathName parameter. The iAttribute parameter specifies the attributes of the file when the function opens it. If the file does not exist, the function creates a new file and opens it for writing. If the file does exist, the function truncates the file size to zero and opens it for reading and writing. When the function opens the file, the pointer is set to the beginning of the file.

Parameter Type/Description  

lpPathName LPSTR Points to a null-terminated character string that names the file to be opened. The string must consist of characters from the ANSI character set.  
iAttribute int Specifies the file attributes. The parameter must be one of these values:  
  Value Meaning
  0 Normal; can be read or written without restriction.
  1 Read-only; cannot be opened for write; a file with the same name cannot be created.
Parameter Type/Description  

  Value Meaning
  2 Hidden; not found by directory search.
  3 System; not found by directory search.

Return Value

The return value specifies an MS-DOS file handle if the function was successful. Otherwise, the return value is –1.