• Keine Ergebnisse gefunden

_dos_getdate, _dos_setdate, getdate, setdate dos.h

Im Dokument Library Reference (Seite 90-95)

Function Syntax

Remarks

Gets and sets system date.

void _dos_getdate(struct dosdate_t *datep)i unsigned _dos_setdate(struct dosdate_t *datep}i void getdate(struct date *datep) i

void setdate(struct date *datep)i

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.

The date structure is defined as follows:

struct date { int da...,yeari char da_daYi char da_moni

}i

/* current year */

/* day of the month */

/* month (1 = Jan) */

_dos...getdate fills in the dosdate_t structure (pointed to by datep) with the system's current date.

_dos~etdate, _dos_setdate, getdate, setdate

Return value

See also

Function Syntax

Remarks

Return value

See also

The dosdate_t structure is defined as follows:

struct dosdate_t {

unsigned char day; /* 1-31 */

unsigned char month; /* 1-12 */

unsigned int year; /* 1980 - 2099 */

unsigned char dayofweek; /* 0 - 6 (O=Sunday) */

};

_dos-$etdate, getdate, a:nd setdate do not return a value.

If the date is set successfully, _dos_setdate returns O. Otherwise, it returns a nonzero value and the global variable errno is set to

EINV AL Invalid date ctime, gettime, settime

dos.h

Gets disk free space.

unsigned _dos_getdiskfree(unsigned char drive, struct diskfree_t *dtable);

_dos-$etdiskfree accepts a drive specifier in drive (0 for default, 1 for A, 2 for B, and so on) and fills in the diskfree_t structure pointed to by dtable with . disk characteristics.

The diskfree _t structure is defined as follows:

struct diskfree_t {

};

unsigned avail_clusters;

unsigned total_clusters;

unsigned bytes-per_sector;

unsigned sectors-per_cluster;

/* available clusters ~/

/* total clusters */

/* bytes per sector */

/* sectors per cluster ~/

_dos-$etdiskfree returns 0 if successful. Otherwise, it returns a nonzero value and the global variable errno is s~t to

EINVAL getfat, getfatd

Invalid drive specified

Function Syntax

Remarks

Return value See also

Function

Synt~x

Remarks

Gets and sets the current drive number.

dos.h II

void _dos_getdrive(unsigned *drivep);

void _dos_setdrive(unsigned drivep, unsigned *ndrives);

II DOS UNIX Win 16 I Win 32 I ANSI C ANSI C++ OS/2

II • •

I

I

_dos-$etdrive gets the current drive number.

_dos_setdrive sets the current drive and stores the total number of drives at the location pointed to by ndrives.

The drive numbers at the location pointed to by drivep are as follows: 1 for A, 2 for B, 3 for C, and so on.

This function changes the current drive of the parent process.

None. Use _dos-$etdrive to verify that the current drive was changed successfully.

getcwd_

Changes file access mode.

int _dos_getfileattr(const char *path, unsigned *attribp);

int _dos_setfileattr(const char *path, unsigned attrib);

dos.h

_dos-$etfileattr fetches the file attributes for the file path. The attributes are stored at the location pointed to by attribp.

_dos_setfileattr sets the file attributes for the file path to the value attrib. The file attributes can be an OR combination of the following symbolic

constants (defined in dos.h):

_A_RDONLY _A_HIDDEN

Read-only attribute Hidden file

Return value

Normal file (no attribute bits set)

Upon successful completion,_dos-$etfileattr and _dos_setfileattr return O.

Otherwise, these functions return the operating system error code, and the global variable errno is set to

ENOENT Path or file name not found chmod, stat

Gets and sets file date and time.

unsigned _dos_getftime(int handle, unsigned *datep, unsigned *timep);

unsigned _dos_setftime(int handle, unsigned date, unsigned time);

dos.h

_dos-$etftime retrieves the file time and date for the disk file associated with the open handle. The file must have been previously opened using

_dos_open, _dos_creat, or _dos_creatnew. _dos-$etftime stores the date and time at the locations pointed to by datep and timep.

_dos_setftime.sets the file's new date and time values as specified by date and time.

Note that the date and time values contain bit fields for referring to the file's date and time. The structure of these fields was established by the operat-ing system.

Years since 1980 (for example, 9 here means 1989) The result of seconds divided by 2 (for example, 10 here means 20 seconds)

Minutes Hours

Return value

See also

Function Syntax

Remarks

Return value

See also

_dos~etftime and _dos_setftime return 0 on success.

In the event of an error return, the operating system error code is returned and the global variable errno is set to one of the following values:

EACCES EBADF fstat, stat

Permission denied Bad file number

Gets and sets system time.

void _dos_gettime(struct dostime_t *timep);

unsigned _dos_settime(struct dostime_t *timep);

dos.h

_dos~ettime fills in the dostime_t structure pointed to by timep with the sys-tem's current time.

_dos_settime sets the system time to the values in the dostime_t structure pointed to by timep.

The dostime _t structure is defined as follows:

struct dostime_t { unsigned char hour;

unsigned char minute;

unsigned char second;

unsigned char hsecond;

}i

/* hours 0-23 */

/* minutes 0-59 */

/* seconds 0-59 */

/* hundredths of seconds 0-99 */

~dos ~ettime does not return a value.

If _dos_settime is successful, it returns O. Otherwise, it returns the operating system error code, and the global variable errno is set to:

EINV AL Invalid time

_dos~etdate, _dos_setdate, _dos_settime, stime, time

Function Gets interrupt vector.

Syntax void interrupt(*_dos_getvect(unsigned interruptno)) ()i

Remarks Every processor of the 8086 family includes a set of interrupt vectors, numbered 0 to 255. The 4-byte value in each vector is actually an address, which is the location of an interrupt function.

Return value See also

Function Syntax

Remarks

_dos-$etvect reads the value of the interrupt vector given by interruptno and returns that value as a (far) pointer to an interrupt function. The value of interruptno can be from 0 to 255.

_dos-$etvect returns the current 4-byte value stored in the interrupt vector named by interruptno.

Im Dokument Library Reference (Seite 90-95)