动态网站制作指南 [  QQ表情  ]
[ 投票调查 ]
[ 企业邮箱 ]
[ 网站空间 ]
网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
ASP源码 | .Net源码 | PHP源码 | JSP源码 | JAVA源码 | CGI源码 | VB源码 | C++源码 | Delphi源码 | PB源码 | VF源码 | 汇编 | 服务器
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > C/C++教程
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
网络编程:ASP教程,ASP.NET教程,PHP教程,JSP教程,C#教程,数据库,XML教程,Ajax,Java,Perl,Shell,VB教程,Delphi,C/C++教程,软件工程,J2EE/J2ME,移动开发
文章搜索服务
邮件订阅
输入你的邮件地址,
你将不会错过任何关于:
[ C/C++教程 ]的信息

本月文章推荐
.获取GetLastError返回信息.
.将文件或目录删除到回改站.
.用ADO压缩Access2000库.
.制作透明窗体.
.C++箴言:谨慎考虑资源管理类的拷.
.More Effective C++:不同new和d.
.对C++标准委员会强制For循环的不.
.C++ Builder 设计应用.
.C++中类的多态与虚函数的使用.
.C++箴言:拷贝一个对象的所有组成.
.C语言程序设计基础之联合.
.从当前的浏览器取得当前URL.
.慎用url重写.
.扑克牌的发牌程序(用伪随机数实.
.C / C++的和Java的异常机制.
.c++面向对象的编程入门篇--类构造.
.c++中布尔类型的入门教程.
.这些样式表,你都用过么?.
.排序算法比较程序.
.用Foxmail的地址传播病毒.

C语言库函数(H类字母)

发表日期:2008-3-8 |


     
函数名: harderr 
功  能: 建立一个硬件错误处理程序 
用  法: void harderr(int (*fptr)()); 
程序例: 
/*This program will trap disk errors and prompt 
the user for action. Try running it with no 
disk in drive A: to invoke its functions.*/ 

#include <stdio.h> 
#include <conio.h> 
#include <dos.h> 
#define IGNORE  0 
#define RETRY   1 
#define ABORT   2 
int buf[500]; 
/*define the error messages for trapping disk problems*/ 
static char *err_msg[] = { 
    "write protect", 
    "unknown unit", 
    "drive not ready", 
    "unknown command", 
    "data error (CRC)", 
    "bad request", 
    "seek error", 
    "unknown media type", 
    "sector not found", 
    "printer out of paper", 
    "write fault", 
    "read fault", 
    "general failure", 
    "reserved", 
    "reserved", 
    "invalid disk change" 
}; 

error_win(char *msg) 

   int retval; 

   cputs(msg); 

/*prompt for user to press a key to abort, retry, ignore*/ 
   while(1) 
   { 
       retval= getch(); 
       if (retval == 'a'  retval == 'A') 
       { 
    retval = ABORT; 
    break; 
       } 
       if (retval == 'r'  retval == 'R') 
       { 
    retval = RETRY; 
    break; 

       } 
       if (retval == 'i'  retval == 'I') 
       { 
           retval = IGNORE; 
           break; 
       } 
   } 

   return(retval); 


/*pragma warn -par redUCes warnings which occur 
due to the non use of the parameters errval, 
bp and si to the handler.*/ 
#pragma warn -par 

int handler(int errval,int ax,int bp,int si) 

   static char msg[80]; 
   unsigned di; 
   int drive; 
   int errorno; 
   di= _DI; 
/*if this is not a disk error then it was 
another device having trouble*/ 

   if (ax < 0) 
   { 
      /* report the error */ 
      error_win("Device error"); 
      /* and return to the program directly requesting abort */ 
      hardretn(ABORT); 
   } 
/* otherwise it was a disk error */ 
   drive = ax & 0x00FF; 
   errorno = di & 0x00FF; 
/* report which error it was */ 
   sprintf(msg, "Error: %s on drive %c\r\nA)bort, R)etry, I)gnore: ", 
    err_msg[errorno], 'A' + drive); 
/* 
return to the program via dos interrupt 0x23 with abort, retry, 
or ignore as input by the user. 
*/ 
   hardresume(error_win(msg)); 
   return ABORT; 

#pragma warn +par 

int main(void) 


/* 
install our handler on the hardware problem interrupt 
*/ 
   harderr(handler); 
   clrscr(); 
   printf("Make sure there is no disk in drive A:\n"); 
   printf("Press any key ....\n"); 
   getch(); 
   printf("Trying to Access drive A:\n"); 
   printf("fopen returned %p\n",fopen("A:temp.dat", "w")); 
   return 0; 

  
  

函数名: hardresume 
功  能: 硬件错误处理函数 
用  法: void hardresume(int rescode); 
程序例: 
  

/* This program will trap disk errors and prompt the user for action. */ 
/* Try running it with no disk in drive A: to invoke its functions    */ 

#include <stdio.h> 
#include <conio.h> 
#include <dos.h> 

#define IGNORE  0 
#define RETRY   1 
#define ABORT   2 

int buf[500]; 

/* define the error messages for trapping disk problems */ 
static char *err_msg[] = { 
    "write protect", 
    "unknown unit", 
    "drive not ready", 
    "unknown command", 
    "data error (CRC)", 
    "bad request", 
    "seek error", 
    "unknown media type", 
    "sector not found", 
    "printer out of paper", 
    "write fault", 
    "read fault", 
    "general failure", 
    "reserved", 
    "reserved", 
    "invalid disk change" 
}; 

error_win(char *msg) 

   int retval; 


   cputs(msg); 

/* prompt for user to press a key to abort, retry, ignore */ 
   while(1) 
   { 
       retval= getch(); 
       if (retval == 'a'  retval == 'A') 
       { 
           retval = ABORT; 
           break; 
       } 
       if (retval == 'r'  retval == 'R') 
       { 
           retval = RETRY; 
           break; 
       } 
       if (retval == 'i'  retval == 'I') 
       { 
           retval = IGNORE; 
           break; 
       } 
   } 

   return(retval); 


/* pragma warn -par reduces warnings which occur due to the non use */ 
/* of the parameters errval, bp and si to the handler.              */ 
#pragma warn -par 

int handler(int errval,int ax,int bp,int si) 

   static char msg[80]; 
   unsigned di; 
   int drive; 
   int errorno; 

   di= _DI; 
/* if this is not a disk error then it was another device having trouble */ 

   if (ax < 0) 
   { 
      /* report the error */ 
      error_win("Device error"); 
      /* and return to the program directly 

      requesting abort */ 
      hardretn(ABORT); 
   } 
/* otherwise it was a disk error */ 
   drive = ax & 0x00FF; 
   errorno = di & 0x00FF; 
/* report which error it was */ 
   sprintf(msg, "Error: %s on drive %c\r\nA)bort, R)etry, I)gnore: ", 
           err_msg[errorno], 'A' + drive); 
/* return to the program via dos interrupt 0x23 with abort, retry */ 
/* or ignore as input by the user.  */ 
   hardresume(error_win(msg)); 
   return ABORT; 

#pragma warn +par 

int main(void) 

/* install our handler on the hardware problem interrupt */ 
   harderr(handler); 
   clrscr(); 
   printf("Make sure there is no disk in drive A:\n"); 
   printf("Press any key ....\n"); 
   getch(); 
   printf("Trying to access drive A:\n"); 
   printf("fopen returned %p\n",fopen("A:temp.dat", "w")); 
   return 0; 

  
  

函数名: highvideo 
功  能: 选择高亮度文本字符 
用  法: void highvideo(void); 
程序例: 

#include <conio.h> 

int main(void) 

   clrscr(); 

   lowvideo(); 
   cprintf("Low Intensity text\r\n"); 
   highvideo(); 
   gotoxy(1,2); 
   cprintf("High Intensity Text\r\n"); 

   return 0; 

  
  

函数名: hypot 
功  能: 计算直角三角形的斜边长 
用  法: double hypot(double x, double y); 
程序例: 

#include <stdio.h> 
#include <math.h> 

int main(void) 

   double result; 

   double x = 3.0; 
   double y = 4.0; 

   result = hypot(x, y); 
   printf("The hypotenuse is: %lf\n", result); 

   return 0; 

上一篇:C语言库函数(I类字母) 人气:492
下一篇:C语言库函数(G类字母)-5 人气:622
浏览全部C/C++的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-10-10 企业网站智能管理系统(TZIMS) v6
2008-10-10 拓文asp.net网站内容管理系统 v6
2008-10-10 动网论坛PHP版 v2.0++ Build 081
2008-10-10 免费时代CMS v5.0
2008-10-10 wodig第四季中文DIGG社区 v4.1 b
2008-10-10 老Y文章管理系统 v2.2 bulid 081
2008-10-10 魔法盒动感相册 ASP+SQL版 v2.0
2008-10-10 Asoft签到管理系统 v3.0 Pack1
2008-10-10 哥特人音乐网潮流留言本 v1.1
2008-10-11 联系人分组工具 v1.1 中文破解版
2008-10-11 FaceMelter变脸 v2.0 汉化破解版
2008-10-11 PathTracker道路跟踪仪 v1.2 破解
2008-10-11 Rooms手机聊天室 v0.6.7 破解版
2008-10-11 RemoteDesktop远程桌面 v1.0 破解
2008-10-11 ProRemote远程调音台 v1.0.1 破解
2008-10-11 PicShare照片共享 v1.0.0 破解版
2008-10-11 Photogene照片编辑器 v1.5 汉化破
2008-10-11 WriteRoom共享文档 v1.0 破解版
  发表评论
姓 名: 验证码:
内 容:
站长工具:网站收录查询 | Google PR查询 | ALEXA排名查询 | CSS在线编辑器 | 广告代码 | js/vbs加密 | md5加密 | 进制转换 | UTF-8 转换工具 | Html转换js | Html转换asp | Html转换php | Html转换perl
实用工具:汉字翻译拼音 | 拼音字典 | 符号对照表 | 个税计算 | 实时汇率查询换算 | 经典小工具 | 汉字简繁转换 | 普通单位换算 | 公制单位换算 | 生辰老黄历 | 国内电话区号 | 国家代码与域名缩写 | 文字加密解密 | 健康查询 | 万年历 | 汉字横竖排版 | 手机号码查询 | 计算器 | ip搜索
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号