/*从键盘中读取字符 功能:按下普通键时,返回其ASCII码 扫描码CODE=0*/ int INKEY(int *code) { int m; while(!bioskey(1))/*可加入无按键时代码*/; *code=bioskey(0); m=*code*255; if(!m) m=*code>>8; *code=*code&255; return m; }
/*获取机器日期*/ int DATE(char *s,char type) { char dat[30]; int num; strUCt tm *tblock; time_t t; t=time(NULL); tblock=localtime(&t); strcpy(dt,asctime(tblock)); strcpy(s,""); switch(type) { case 'N': num=(*tblock).tm_year+1900; itoa(num,s,10); break; case 'Y': num=(*tblock).tm_mon+1; itoa(num,s,10); break; case 'R': num=(*tblock).tm_mday; itoa(num,s,10); break; case 'S': strcpy(dt,asctime(tblock)); MID(s,dt,12,8); break; } } return num; }