getdate,setdate
dos.h:インデックス への移動
ヘッダーファイル
dos.h
カテゴリ
日付/時刻ルーチン
プロトタイプ
void getdate(struct date *datep);
void setdate(struct date *datep);
説明
システム日付を取得または設定します。
getdate は,(datep が指す)date 構造体にシステムの現在の日付を設定します。
setdate は,システム日付(月,日,年)に datep が指す date 構造体の値を設定します。オペレーティングシステムから要求される権限がない場合は,日付の設定要求が失敗する場合があります。
date 構造体は,次のように定義されています。
struct date{
int da_year; /* 現在の年 */
char da_day; /* 日 */
char da_mon; /* 月(1 = 1 月) */
};
戻り値
getdate と setdate は値を返しません。
例
#include <dos.h>
#include <stdio.h>
int main(void)
{
struct date d;
getdate(&d);
printf("The current year is: %d\n", d.da_year);
printf("The current day is: %d\n", d.da_day);
printf("The current month is: %d\n", d.da_mon);
return 0;
}