home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 1
/
FishNMoreVol1.bin
/
more
/
code_examples
/
librar
/
settdate.c
< prev
next >
Wrap
Text File
|
1989-02-08
|
1KB
|
42 lines
/*--------------------------------------*/
/* */
/* SETTDATE(X) */
/* */
/* Functionality: */
/* Sets the system's date to the */
/* argument given. The argument */
/* is in the form "MM/DD/YY". */
/* Arguments: */
/* 0: The date to be set. */
/* Returns: Nothing */
/* Author: John Callicotte */
/* Date created/modified: 08/31/88 */
/* */
/*--------------------------------------*/
# include "dos.h"
# include "stdlib.h"
void settdate(r)
char r[8];
{
struct date dait;
char s[3];
int j;
for (j=0;j<2;j++) /* Pull in the month from the */
s[j]=r[j]; /* argument, convert it to an */
s[2]=0; /* integer, and put it in the */
dait.da_mon=atoi(s); /* structure for setdate(). */
for (j=0;j<2;j++) /* Ditto for the day */
s[j]=r[j+3];
s[2]=0;
dait.da_day=atoi(s);
for (j=0;j<2;j++) /* Ditto for the year */
s[j]=r[j+6];
s[2]=0;
dait.da_year=atoi(s)+1900;
setdate(&dait); /* Call the Turbo C function that */
/* sets the system date. */
}