RAD Studio |  |

dos.h
Collapse All

The following functions, macros, and classes are provided in dos.h:

Topics

Name | Description
FA_xxxx #defines | Header File dos.h Description File attributes
NFDS #define | Header File dos.h Description Maximum number of file descriptors.
_getdrive | Header File dos.h Category Directory Control Routines Prototype int _getdrive(void); Description Gets the current drive. _getdrive gets the the current drive number. It returns an integer: 0 for A, 1 for B, 2 for C, and so on. Return Value _getdrive returns the current drive number on success or -1 in the event of error. Example
_osmajor | Header File dos.h Syntax extern unsigned char _osmajor; Description The major version number of the operating system is available individually through _osmajor. For example, if you are running DOS version 3.2, _osmajor will be 3. This variable can be useful when you want to write modules that will run on DOS versions 2.x and 3.x. Some library routines behave differently depending on the DOS version number, while others only work under DOS 3.x and higher. For example, refer to creatnew and _rtl_open.
_osminor | Header File dos.h Syntax extern unsigned char _osminor; Description The minor version number of the operating system is available individually through _osminor. For example, if you are running DOS version 3.2, _osminor will be 20. This variables can be useful when you want to write modules that will run on DOS versions 2.x and 3.x. Some library routines behave differently depending on the DOS version number, while others only work under DOS 3.x and higher. For example, refer to creatnew and _rtl_open.
_osversion | Header File dos.h Syntax extern unsigned _osversion; Description _osversion contains the operating system version number, with the major version number in the low byte and the minor version number in the high byte. (For DOS version x.y, the x is the major version number, and y is the minor version number.) _osversion is functionally identical to _version.
_sleep | Header File dos.h Category Process Control Routines Prototype void _sleep(unsigned seconds); Description Suspends execution for an interval (seconds). With a call to _sleep, the current program is suspended from execution for the number of seconds specified by the argument seconds. The interval is accurate only to the nearest hundredth of a second or to the accuracy of the operating system clock, whichever is less accurate. Return Value None. Example
_version | Header File dos.h Syntax extern unsigned _version; Description _version contains the operating system version number, with the major version number in the low byte and the minor version number in the high byte. (For DOS version x.y, the x is the major version number, and y is the minor version number.)
disable, _disable, enable, _enable | Header File dos.h Category Miscellaneous Routines Prototype void disable(void); void _disable(void); void enable(void); void _enable(void); Description Disables and enables interrupts. These macros are designed to provide a programmer with flexible hardware interrupt control. disable and _disable macros disable interrupts. Only the NMI (non-maskable interrupt) is allowed from any external device. enable and _enable macros enable interrupts, allowing any device interrupts to occur. Return Value None. Portability
dostounix | Header File dos.h Category Time and Date Routines Prototype long dostounix(struct date *d, struct time *t); Description Converts date and time to UNIX time format. dostounix converts a date and time as returned from getdate and gettime into UNIX time format. d points to a date structure, and t points to a time structure containing valid date and time information. The date and time must not be earlier than or equal to Jan 1 1980 00:00:00. Return Value Returns UNIX version of current date and time parameters: number of seconds since 00:00:00 on January 1, 1970 (GMT). Example
geninterrupt | Header File Category Prototype void geninterrupt(int intr_num); Description Return Value Portability
getdate, setdate | Header File dos.h Category Time and Date Routines Prototype void getdate(struct date *datep); void setdate(struct date *datep); Description Gets and sets system date. getdate fills in the date structure (pointed to by datep) with the system's current date. setdate sets the system date (month, day, and year) to that in the date structure pointed to by datep. Note that a request to set a date might fail if you do not have the privileges required by the operating system. The date structure is defined as follows: struct date{ int da_year; /* current year */ char da_day; /* day of the... more
getdfree | Header File dos.h Category Directory Control Routines, Miscellaneous Routines Prototype void getdfree(unsigned char drive, struct dfree *dtable); Description Gets disk free space. getdfree accepts a drive specifier in drive (0 for default, 1 for A, and so on) and fills the dfree structure pointed to by dtable with disk attributes. The dfree structure is defined as follows: struct dfree { unsigned df_avail; /* available clusters */ unsigned df_total; /* total clusters */ unsigned df_bsec; /* bytes per sector */ unsigned df_sclus; /* sectors per cluster */ }; Return Value getdfree returns no value. In the event of an error, df_sclus... more

gettime, settime
Header File
dos.h
Category
Time and Date Routines
Prototype
void gettime(struct time *timep);
void settime(struct time *timep);
Description
Gets and sets the system time.
gettime fills in the time structure pointed to by timep with the system's current time.

- settime sets the system time to the values in the time structure pointed to by timep.

The time structure is defined as follows:
struct time {
unsigned char ti_min; /* minutes */
unsigned char ti_hour; /* hours */
unsigned char ti_hund; /* hundredths of seconds */
unsigned char ti_sec; /* seconds */
};
Return Value
None.
Example
unixtodos
Header File
dos.h
Category
Time and Date Routines
Prototype
void unixtodos(long time, struct date *d, struct time *t);
Description
Converts date and time from UNIX to DOS format.
unixtodos converts the UNIX-format time given in time to DOS format and fills in the date and time structures pointed to by d and t.
time must not represent a calendar time earlier than Jan. 1, 1980 00:00:00.
Return Value
None.
Example
_unlink, _wunlink
Header File
dos.h
Category
Input/output Routines
Prototype
int _unlink(const char *filename);
int _wunlink(const wchar_t *filename);
Description
Deletes a file.
_unlink deletes a file specified by filename. Any drive, path, and file name can be used as a filename. Wildcards are not allowed.
Read-only files cannot be deleted by this call. To remove read-only files, first use chmod or _rtl_chmod to change the read-only attribute.
Note: If the file is open, it must be closed before unlinking it.
_wunlink is the Unicode version of _wunlink. The Unicode version accepts a filename that is a wchar_t character string. Otherwise, the functions perform... more

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!