File Naming
Windows supports hierarchical file naming, but there are a few subtle distinctions for the UNIX user and basic rules for everyone.
- The full pathname of a disk file starts with a drive name, such as A: or C:. The A: and B: drives are normally diskette drives, and C:, D:, and so on are hard discs and CD-ROMs. Network drives are usually designated by letters that fall later in the alphabet, such as H: and K:. Note: CE does not support drive letters.
- Alternatively, a full pathname, or Universal Naming Code (UNC), can start with a double backslash (\\), indicating the global root, followed by a server name and a share name to indicate a path on a network file server. The first part of the pathname, then, is \\servername\sharename.
- The pathname separator is the backslash (\), although the forward slash (/) can be used in API parameters, which is more convenient in C.
- Directory and file names cannot contain any of the ASCII characters with values in the range 131 or any of these characters:
Names can contain blanks. However, when using file names with blanks on a command line, be sure to put each file name in quotes so that the name is not interpreted as naming two distinct files.
< > : " | ? * \ / - Directory and file names are case-insensitive, but they are also case-retaining, so that if the creation name is MyFile, the file name will show up as it was created, but the file can also be accessed with the name myFILE.
- File and directory names can be as many as 255 characters long, and pathnames are limited to MAX_PATH characters (currently 260).
- A period (.) separates a file's name from its extension, and extensions (usually two or three characters after the rightmost period in the file name) conventionally indicate the file's type. Thus, atou.EXE would be an executable file, and atou.C would be a C language source file. File names can contain multiple periods.A single period (.) and two periods (..), as directory names, indicate the current directory and its parent, respectively.
With this introduction, it is now time to learn more about the Windows functions introduced in Chapter 1.