|
![]() | 作者: cimsxiyang [cimsxiyang]
![]() |
登录 |
#include<stdio.h> #include<stdlib.h> #include<conio.h> #include<dos.h> int i; FILE *fp; void rdcmos(void); void savecmos(void); void wtcmos(void); int main() { system("cls"); printf("\n\n\tSave CMOS Data && Restore CMOS Date Programe \n\n"); printf("\t1.Save CMOS Data to File:CMOS.DAT\n"); printf("\t2.Restore CMOS Data from File:CMOS.DAT\n"); printf("\n\t Please Input Your Choice:"); scanf("%d",&i); switch(i){ case 1: rdcmos(); break; case 2: wtcmos(); break; default: printf("\n\tWrong Choice!"); exit(1); break; } return 0; } void rdcmos(void) { if((fp=fopen("CMOS.DAT","rb"))!=NULL){ printf("\n\tFile:CMOS.DAT Already Exist,Overwrite(Y/N)?"); i=getchar(); if((i=='Y')||(i=='y')){ fclose(fp); system("IF EXITST CMOS.BAK DEL CMOS.BAK"); system("REN CMOS.DAT CMOS.BAK"); savecmos(); } else exit(1); } else savecmos(); } void savecmos(void) { if((fp=fopen("CMOS.DAT","wb"))==NULL){ printf("\n\t Can not Open File:CMOS.DAT\n"); exit(1); } for(i=0;i<256;i++) { outportb(0x70,i); putc(i,fp); } fclose(fp); } void wtcmos(void) { if((fp=fopen("CMOS.DAT","rb"))==NULL) { printf("\n\tFile:CMOS.DAT Does not Exist!"); exit(1); } for(i=0;i<256;i++){ outportb(0x70,i); outportb(0x71,fgetc(fp)); } fclose(fp); } /*一些人一提到系统编程,就..........该程序浅显易懂,让你打打气!*/ |
地主 发表时间: 05/23 00:11 |
![]() | 回复: sainthero [sainthero] ![]() |
登录 |
对了 能不能告诉我在哪个版本的c中有device.h |
B1层 发表时间: 05/23 01:28 |
![]() | 回复: cimsxiyang [cimsxiyang] ![]() |
登录 |
http://www.esrf.fr/computing/cs/taco/doc/notes/DSN109/node4.html 看看这个。不过呢?是c++ |
B2层 发表时间: 05/24 09:11 |
|
20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon
粤ICP备05087286号