File Handling
Use these routines to create, delete, and manipulate files and to set and check file-access permissions.
The C run-time libraries have a preset limit for the number of files that can be open at any one time. The limit for applications that link with the single-thread static library (LIBC.LIB) is 64 file handles or 20 file streams. Applications that link with either the static or dynamic multithread library (LIBCMT.LIB or MSVCRT.LIB and MSVCRT.DLL), have a limit of 256 file handles or 40 file streams. Attempting to open more than the maximum number of file handles or file streams causes program failure.
The following routines operate on files designated by a file handle:
File-Handling Routines (File Handle)
Routine | Use |
_chsize | Change file size |
_filelength | Get file length |
_fstat, _fstati64 | Get file-status information on handle |
_isatty | Check for character device |
_locking | Lock areas of file |
_setmode | Set file-translation mode |
The following routines operate on files specified by a path or filename:
File-Handling Routines (Path or Filename)
Routine | Use |
_access, _waccess | Check file-permission setting |
_chmod, _wchmod | Change file-permission setting |
_fullpath, _wfullpath | Expand a relative path to its absolute path name |
_get_osfhandle | Return operating-system file handle associated with existing stream FILE pointer |
_makepath, _wmakepath | Merge path components into single, full path |
_mktemp, _wmktemp | Create unique filename |
_open_osfhandle | Associate C run-time file handle with existing operating-system file handle |
remove, _wremove | Delete file |
rename, _wrename | Rename file |
_splitpath, _wsplitpath | Parse path into components |
_stat, _stati64, _wstat, _wstati64 | Get file-status information on named file |
_umask | Set default permission mask for new files created by program |
_unlink, _wunlink | Delete file |