The library includes functions typically defined by ANSI standard or UNIX C libraries, plus enhancements to the standard set. It includes C++ classes for working with streams and for performing mathematical computations.
C functions can be called from either C or C++ programs, but the C++ classes can be used only with C++ programs.
Name: _access Synonym: access
int _access(char *path, int mode);
int access(char *path, int mode);
Some function descriptions have a Special Results table that describes how the function handles certain kinds of arguments. In these tables, the column headings have the following meanings:
All of these functions return a NaN if one of its arguments is a NaN. If the argument is a signalling NaN, the function will also raise the FE_INVALID exception.
Each name in this chapter has a section that lists available platforms. If a name is not compatible with a platform, a line is drawn through the platform. Platforms are: DOS, Windows 3.x, Phar Lap, DOSX, and Win32.
Digital Mars C++ supports wildcard expansion in command line arguments via the EXPAND_WILDCARDS macro. The following program shows the use of wildcard expansion. It prints all of its argument. If you invoke this program with "*.*" or other wildcarded arguments, it will print all of the files that match the specified arguments. This program can be compiled and linked normally; no additional object files are necessary.
/* argsdemo.c */ /* --Invoke with wildcards in the arguments */ #include <stdio.h> #include <dos.h> EXPAND_WILDCARDS; // use wildcard support int main(int argc, char *argv[]) { int i; for (i = 0; i < argc; ++i) printf("argv[%d] = '%s'\n", i, argv[i]); return 0; }
For more information see the definition of the EXPAND_WILDCARDS macro in dos.h, and the code in the \dm\src\core\_main.c.
This chapter groups related functions and variables into categories. Missing from the categories are the functions in the Iostream Library.
These functions provide easy access from C to 80x86 registers, ports, and segmented memory.
These functions directly access the ROM BIOS routines that are built into every PC compatible computer.
These functions classify characters into a number of useful categories, and provide conversions from one category to another.
These functions perform mathematics on complex numbers. The functions also treat complex numbers like real numbers or integers.
Normally, the user of a DOS program can press control-c to immediately terminate execution of a program. These functions allow the program to control what happens when control-c is pressed.
These functions manipulate directories and disk drives.
These functions write directly into screen memory. They are suitable for use only on IBM compatible displays (or BIOS) and only in text mode. Using them in graphics mode is not recommended; erratic behavior can occur. If a machine has a BIOS that is IBM compatible, but has a display that is not totally IBM compatible, use the function disp_usebios to force the other disp_functions to access screens through the BIOS. The functions work correctly with the DOSX extender and with Win32. See disp.h.
These functions access miscellaneous features and data structures that are only available from the DOS operating system.
Environment variables are a set of named string values maintained by the operating system. An example of an environment variable is the PATH variable, which tells the operating system where to look for programs.
When a program starts, it is given a copy of the previous program's environment (usually the OS environment); any changes the program makes to its copy are discarded when the program exits. However, if a program creates a child process, the child receives the parent's environment, with any changes the parent process made to it.
These variables and functions allow a program to access and modify environment variables. See also the spawn and exec functions.
These functions and variables are related to the trapping, identification, and reporting of errors in programs.
Expanded Memory Manager (EMM) functions can be used as an alternative to, or at the same time as, the __handle pointer system and offer more control of an application's expanded memory usage.
These functions manage and search for files but do not change a file's contents.
These functions use the __handle pointer to dynamically allocate, use, and free memory.
I/O management for C can be grouped into four general areas: unbuffered, handle-based routines; buffered, stream-based routines; operating system I/O; and console I/O routines.
These functions provide low-level access to files and devices. Files are accessed via a handle, which is an integer. Note that file handles used with DOS INT 21 calls and Win32 calls are not necessarily the same as handles used with the unbuffered, handle-based I/O functions, and should not be interchanged.
Buffering means that data are read from and written to files and devices in chunks, rather than one byte at a time. Each chunk is stored in a memory buffer. This method reduces the number of disk accesses needed and speeds up I/O.
For example, suppose a program needs to read a file a byte at a time. The buffered stream functions retrieve each byte from the buffer in memory, avoiding a disk access for each read operation. Only when the buffer is empty do the functions fetch another chunk from the disk.
Rather than using an integer handle, these functions use a pointer to a structure that contains information about the status of the buffers.
These functions are similar to the unbuffered, handle-based I/O functions, but use more direct calls to DOS or Win32. As noted before, DOS INT 21 and Win32 handles must not be interchanged with handles used by direct operating system I/O functions, nor should handles from these functions be used with the unbuffered, handle-based functions.
These low level functions give the program access to the computer display and keyboard, also known as the console. The stream and handle based I/O functions can also be used to read and write from the display and keyboard devices, but the console I/O functions provide more direct control over whether characters are echoed on input, whether a key is available in the keyboard buffer, etc.
There is one DOS console. Windows NT provides any number of consoles. Windows 3.x provides no console; console I/O functions are not available for Windows 3.x.
These functions allow programs to generate and trap 80x86 interrupts. See also the Interrupt Package category.
These functions, from Digital Mars, handle interrupts, signals, and errors. An interrupt function can create a stack of a specified size that conforms to constraints of the memory model used. See also the Interrupt Handling category.
These functions allow programs to easily adapt to the different conventions used in different parts of the world.
Digital Mars C++ provides a large library of math functions.
These functions operate on arrays of characters, much like the string functions, but do not assume a terminating null character.
Digital Mars C++ provides two kinds of memory management, program memory management and operating system memory management.
For DOS and Windows 3.x programs, the situation is complicated by the 80x86 architecture, which has two kinds of pointers to memory: near pointers and far pointers. Near pointers are small and efficient but can access only 64K bytes at a time. Far pointers are less efficient but can access the entire memory space, up to one MB for real mode. Because of this, DOS and Windows 3. x have two heaps: a smaller near one and a larger far one. Phar Lap and Win32 programs have only one heap.
DOS and Windows 3.x usually have three versions of each memory management function:
Phar Lap and Win32 have only a plain function. For example, malloc allocates from the heap. Functions _nmalloc and _fmalloc are not available.
These functions call the operating system (DOS, Phar Lap, Windows 3.x, or Win32) directly to dynamically allocate and free memory blocks. The function descriptions list compatible operating systems.
These functions interface to the Microsoft mouse and require that a Microsoft compatible mouse driver be installed. See the manual that accompanies the mouse. Two of the functions enable the mouse to emulate a lightpen.
These functions provide conversions between multi-byte characters and wide characters.
These functions and multi-threaded processing are available for Win32 programs only.
These variables contain the version number of the operating system and Windows under which the program is running.
These functions create and manipulate memory from the page heap. They require a far pointer to the page heap.
These functions manipulate path names.
These functions and variables control execution of processes.
These functions return, initialize, or set random numbers.
These functions sort and search tables.
These functions output sound from the PC speaker. They work only on machines that are compatible with the IBM PC hardware and software.
These functions operate on null-terminated strings.
These functions convert between various C numeric types and strings.
These functions move a spawned program's memory image to a temporary disk file.
These functions control the tab size.
The Terminate and Stay Resident (TSR) functions are useful in programs that can optionally reside in memory or run as a background process.
These functions and variables access the system time, convert from one time format to another, and perform other operations regarding the time and date. UCT is Universal Coordinated Timezone.
Any C function declared __cdecl (the default) can potentially have a variable number of arguments. C functions declared __pascal cannot. The following functions access variable arguments.
WINIO functions provide a DOS-like procedure based wrapper over event-driven Windows 3 application code. WINIO is sometimes called WINDOS. See also Appendix D, The WINIO Library.
The X386 functions are implemented for the X memory model only.
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル