The following functions, macros, and classes are provided in dir.h:
Name |
Description |
Header File dir.h Category Directory Control Routines Prototype int chdir(const char *path); int _wchdir(const wchar_t *path); Description Changes current directory. chdir causes the directory specified by path to become the current working directory; path must specify an existing directory. A drive can also be specified in the path argument, such as chdir("a:\\BC") but this method changes only the current directory on that drive; it does not change the active drive.
Upon successful completion, chdir returns a value of 0. Otherwise, it returns a value of -1, and the global variable... more | |
Header File dir.h Description These symbols define the maximum number of characters in a file specification for fnsplit (including room for a terminating NULL). | |
Header File dir.h Category Directory Control Routines Prototype int findclose(struct ffblk *ffblk ); int _wfindclose(struct _wffblk *ffblk ); Description findclose closes any handles and frees up any dynamic memory associated with previous calls to findfirst and findnext. Return Value findclose returns 0 on successfully closing the handle. On failure:
| |
Header File dir.h Category Directory Control Routines Prototype int findfirst(const char *pathname, struct ffblk *ffblk, int attrib); int _wfindfirst( const wchar_t *pathname, struct _wffblk *ffblk, int attrib); Description Searches a disk directory. findfirst begins a search of a disk directory for files specified by attributes or wildcards. pathname is a string with an optional drive specifier path and file name of the file to be found. Only the file name portion can contain wildcard match characters (such as ? or *). If a matching file is found the ffblk structure is filled with the file-directory information. When Unicode is defined,... more | |
Header File dir.h Category Directory Control Routines Prototype int findnext(struct ffblk *ffblk ); int _wfindnext(struct _wffblk *ffblk ); Description Continues findfirst search. findnext is used to fetch subsequent files that match the pathname given in findfirst. ffblk is the same block filled in by the findfirst call. This block contains necessary information for continuing the search. One file name for each call to findnext will be returned until no more files are found in the directory matching the pathname. Return Value findnext returns 0 on successfully finding a file matching the search pathname. When no more files can be found... more | |
Header File dir.h Category Directory Control Routines Prototype void fnmerge(char *path, const char *drive, const char *dir, const char *name, const char *ext); void _wfnmerge(wchar_t *path, const wchar_t *drive, const wchar_t *dir, const wchar_t *name, const wchar_t *ext ); Description Builds a path from component parts. fnmerge makes a path name from its components. The new path name is X:\DIR\SUBDIR\NAME.EXT where: | |
Header File dir.h Category Directory Control Routines Prototype int fnsplit(const char *path, char *drive, char *dir, char *name, char *ext); int _wfnsplit(const wchar_t *path, wchar_t *drive, wchar_t *dir, wchar_t *name, wchar_t *ext ); Description Splits a full path name into its components. fnsplit takes a file's full path name (path) as a string in the form X:\DIR\SUBDIR\NAME.EXT and splits path into its four components. It then stores those components in the strings pointed to by drive, dir, name, and ext. All five components must be passed but any of them can be a null which means the corresponding component will... more | |
Header File dir.h Description Bit definitions returned from fnsplit to identify which pieces of a file name were found during the split. | |
Header File dir.h Category Directory Control Routines Prototype int getcurdir(int drive, char *directory); int _wgetcurdir(int drive, wchar_t *directory ); Description Gets current directory for specified drive. getcurdir gets the name of the current working directory for the drive indicated by drive. drive specifies a drive number (0 for default, 1 for A, and so on). directory points to an area of memory of length MAXDIR where the null-terminated directory name will be placed. The name does not contain the drive specification and does not begin with a backslash. Return Value getcurdir returns 0 on success or -1 in the event... more | |
Header File dir.h Category Directory Control Routines Prototype char *getcwd(char *buf, int buflen); wchar_t *_wgetcwd(wchar_t *buf, int buflen); Description Gets current working directory. getcwd gets the full path name (including the drive) of the current working directory, up to buflen bytes long and stores it in buf. If the full path name length (including the null terminator) is longer than buflen bytes, an error occurs. If buf is NULL, a buffer buflen bytes long is allocated for you with malloc. You can later free the allocated buffer by passing the return value of getcwd to the function free. Return Value... more | |
Header File dir.h Category Directory Control Routines Prototype int getdisk(void); int setdisk(int drive); Description Gets or sets the current drive number. getdisk gets the current drive number. It returns an integer: 0 for A, 1 for B, 2 for C, and so on. setdisk sets the current drive to the one associated with drive: 0 for A, 1 for B, 2 for C, and so on. The setdisk function changes the current drive of the parent process. Return Value getdisk returns the current drive number. setdisk returns the total number of drives available. Example | |
Header File dir.h Category Directory Control Routines Prototype int mkdir(const char *path); int _wmkdir(const wchar_t *path); Description Creates a directory. mkdir is available on UNIX, though it then takes an additional parameter. mkdir creates a new directory from the given path name path. Return Value mkdir returns the value 0 if the new directory was created. A return value of -1 indicates an error, and the global variable errno is set to one of the following values: | |
Header File dir.h Category Directory Control Routines Prototype char *_mktemp(char *template); wchar_t *_wmktemp(wchar_t *template); Description Makes a unique file name. _mktemp replaces the string pointed to by template with a unique file name and returns template. template should be a null-terminated string with six trailing Xs. These Xs are replaced with a unique collection of letters plus a period, so that there are two letters, a period, and three suffix letters in the new file name. Starting with AA.AAA, the new file name is assigned by looking up the name on the disk and avoiding pre-existing names of the same... more | |
Header File dir.h Category Directory Control Routines Prototype int _rmdir(const char *path); int _wrmdir(const wchar_t *path); Description Removes a directory. _rmdir deletes the directory whose path is given by path. The directory named by path
_rmdir returns 0 if the directory is successfully deleted. A return value of -1 indicates an error, and the global variable errno is set to one of the following values: | |
Header File dir.h Category Miscellaneous Routines Prototype char *searchpath(const char *file); wchar_t *wsearchpath( const wchar_t *file ); Description Searches the operating system path for a file. searchpath attempts to locate file, searching along the operating system path, which is the PATH=... string in the environment. A pointer to the complete path-name string is returned as the function value. searchpath searches for the file in the current directory of the current drive first. If the file is not found there, the PATH environment variable is fetched, and each directory in the path is searched in turn until the file is found,... more |
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|