动态网站制作指南 [  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++教程 ]的信息



本月文章推荐
.UNIX 萤幕导向程式的发展利器.
.TList的用法.
.ActiveX技术综述(二) .
.在BCB中使用VCL控件数组.
.C++箴言:理解Terminology术语.
.函数调用,__stdcall,__cdecl,__f.
.关于 MD5 的一些知识.
.C++的心得: 这些秘籍你知道吗?.
.AT&T/x86/asm语法.
.拨号上网IP地址的检知.
.c++经典.
.C++Builder动态更改自定义打印纸.
.我的"欢乐颂"面世了.
.对C++中引用的补充说明(实例).
.C++对象的放置.
.字符串近似匹配算法.
.C++ 中重载 + 操.
.C++中建立对象间消息连接的一种系.
.Boost源码剖析:C++泛型函数指针.
.C语言中的面向对象(4)-面向对象.

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

发表日期:2008-3-8 |


     
函数名: ultoa 
功  能: 转换一个无符号长整型数为字符串 
用  法: char *ultoa(unsigned long value, char *string, int radix); 
程序例: 

#include <stdlib.h> 
#include <stdio.h> 

int main( void ) 

   unsigned long lnumber = 3123456789L; 
   char string[25]; 

   ultoa(lnumber,string,10); 
   printf("string = %s  unsigned long = %lu\n",string,lnumber); 

   return 0; 

  
  
  

函数名: ungetc 
功  能: 把一个字符退回到输入流中 
用  法: int ungetc(char c, FILE *stream); 
程序例: 

#include <stdio.h> 
#include <ctype.h> 

int main( void ) 

   int i=0; 
   char ch; 

   puts("Input an integer followed by a char:"); 

   /* read chars until non digit or EOF */ 
   while((ch = getchar()) != EOF && isdigit(ch)) 
      i = 10 * i + ch - 48; /* convert ASCII into int value */ 

   /* if non digit char was read, push it back into input buffer */ 
   if (ch != EOF) 
      ungetc(ch, stdin); 

   printf("i = %d, next char in buffer = %c\n", i, getchar()); 
   return 0; 

  
  
  

函数名: ungetch 
功  能: 把一个字符退回到键盘缓冲区中 
用  法: int ungetch(int c); 
程序例: 

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

int main( void ) 

   int i=0; 
   char ch; 

   puts("Input an integer followed by a char:"); 


   /* read chars until non digit or EOF */ 
   while((ch = getche()) != EOF && isdigit(ch)) 
      i = 10 * i + ch - 48; /* convert ASCII into int value */ 

   /* if non digit char was read, push it back into input buffer */ 
   if (ch != EOF) 
      ungetch(ch); 

   printf("\n\ni = %d, next char in buffer = %c\n", i, getch()); 
   return 0; 

  
  
  

函数名: unixtodos 
功  能: 把日期和时间转换成DOS格式 
用  法: void unixtodos(long utime, strUCt date *dateptr, 
   struct time *timeptr); 
程序例: 

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

char *month[] = {"---", "Jan", "Feb", "Mar", "Apr", "May", "Jun", 
                 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; 

#define SECONDS_PER_DAY 86400L  /* the number of seconds in one day */ 

struct date dt; 
struct time tm; 

int main(void) 

   unsigned long val; 

/* get today's date and time */ 
   getdate(&dt); 
   gettime(&tm); 
   printf("today is %d %s %d\n", dt.da_day, month[dt.da_mon], dt.da_year); 

/* convert date and time to unix format (number of seconds since Jan 1, 1970 */ 
   val = dostounix(&dt, &tm); 
/* suBTract 42 days worth of seconds */ 
   val -= (SECONDS_PER_DAY * 42); 

/* convert back to dos time and date */ 

   unixtodos(val, &dt, &tm); 
   printf("42 days ago it was %d %s %d\n", 
        dt.da_day, month[dt.da_mon], dt.da_year); 
   return 0; 

  
  
  

函数名: unlink 
功  能: 删掉一个文件 
用  法: int unlink(char *filename); 
程序例: 

#include <stdio.h> 
#include <io.h> 

int main(void) 

   FILE *fp = fopen("junk.jnk","w"); 
   int status; 

   fprintf(fp,"junk"); 

   status = Access("junk.jnk",0); 
   if (status == 0) 
      printf("File exists\n"); 
   else 
      printf("File doesn't exist\n"); 

   fclose(fp); 
   unlink("junk.jnk"); 
   status = access("junk.jnk",0); 
   if (status == 0) 
      printf("File exists\n"); 
   else 
      printf("File doesn't exist\n"); 
  

   return 0; 

  
  
  

函数名: unlock 
功  能: 解除文件共享锁 
用  法: int unlock(int handle, long offset, long length); 
程序例: 

#include <io.h> 
#include <fcntl.h> 
#include <sys\stat.h> 
#include <process.h> 
#include <share.h> 
#include <stdio.h> 

int main(void) 

   int handle, status; 
   long length; 

   handle = sopen("c:\\autoexec.bat",O_RDONLY,SH_DENYNO,S_IREAD); 

   if (handle < 0) 
   { 
       printf("sopen failed\n"); 
       exit(1); 
   } 


   length = filelength(handle); 
   status = lock(handle,0L,length/2); 

   if (status == 0) 
      printf("lock succeeded\n"); 
   else 
      printf("lock failed\n"); 

   status = unlock(handle,0L,length/2); 

   if (status == 0) 
      printf("unlock succeeded\n"); 
   else 
      printf("unlock failed\n"); 

   close(handle); 
   return 0; 


上一篇:C语言库函数(V类字母) 人气:363
下一篇:C语言库函数(T类字母) 人气:380
浏览全部C/C++的内容 Dreamweaver插件下载 常用网页广告代码全集
  最新网站源码 最新软件下载
2008-7-6 飞天论坛FTBBS ASP v6.3 Build 0
2008-7-6 飞天论坛FTBBS ASP v6.3 Build 0
2008-7-6 飞天论坛FTBBS ASP v6.8 Build 0
2008-7-6 讯息内容管理系统 v2.1
2008-7-6 三五电影程序 v2.0
2008-7-6 神鹰腾讯小说小偷 v3.0
2008-7-6 EasyIDE Framework v1.0 Build 2
2008-7-6 品告CMS系统(电影版) v0.9
2008-7-6 QQ自动登录器 C# 源码 v1.0
2008-7-5 AgileMessenger即时通讯工具 v1.
2008-7-5 GoodCalculator2.0版固件计算器
2008-7-5 RepoName源地址搜索工具 v1.21b
2008-7-5 AgileMessenger即时通讯工具 v1.
2008-7-5 TouchCopy多媒体管理软件 v3.13完
2008-7-5 VideosTone视频铃声 v1.1汉化破解
2008-7-5 TouchPad触摸板 v4.44破解版
2008-7-5 VideosTone破解补丁 v1.0
2008-7-5 Feeds GoogleReader客户端 v0.4.3


  发表评论
姓 名: 验证码:
内 容:
[ 汉字翻译拼音 ] [ 广告代码 ] [ 符号对照表 ] [ 进制转换 ] [ 经典小工具 ] [ 个税计算 ] [ 汉字简繁转换 ] [ 普通单位换算 ] [ 公制单位换算 ]
[ 生辰老黄历 ] [ 国内电话区号 ] [ 国家代码与域名缩写 ] [ 文字加密解密 ] [ 健康查询 ] [ 万年历 ] [ 手机号码查询 ] [ ip搜索 ] [ Google PR查询 ]
业务联系 | 广告刊登 | 频道合作 | 投稿荐稿 | 联系方式 | 加入收藏 | RSS订阅
Copyright © 2000-2008 www.knowsky.com All rights reserved | 网络实名:动态网站制作指南 | 沪ICP备05001343号
ホームページ制作 不動産検索システム 求人情報