易截截图软件、单文件、免安装、纯绿色、仅160KB

C标准库函数

函数名: abort
功  能: 异常终止一个进程
用  法: void abort(void);
程序例:
#include <stdio.h>
#include <stdlib.h>
 
int main(void)
{
  printf("Calling abort()\n");
  abort();
  return 0; /* This is never reached */
}
 
 
 
函数名: abs
功  能: 求整数的绝对值
用  法: int abs(int i);
程序例:
#include <stdio.h>
#include <math.h>
 
int main(void)
{
  int number = -1234;
 
  printf("number: %d  absolute value: %d\n", number, abs(number));
  return 0;
}
 
 
 
函数名: absread, abswirte
功  能: 绝对磁盘扇区读、写数据
用  法: int absread(int drive, int nsects, int sectno, void *buffer);
 int abswrite(int drive, int nsects, in tsectno, void *buffer);
程序例:
/* absread example */
 
#include <stdio.h>
#include <conio.h>
#include <process.h>
#include <dos.h>
 
int main(void)
{
  int i, strt, ch_out, sector;
  char buf[512];
 
  printf("Insert a diskette into drive A and press any key\n");
  getch();
  sector = 0;
  if (absread(0, 1, sector, &buf) != 0)
  {
     perror("Disk problem");
     exit(1);
  }
  printf("Read OK\n");
  strt = 3;
  for (i=0; i<80; i++)
  {
     ch_out = buf[strt+i];
     putchar(ch_out);
  }
  printf("\n");
  return(0);
}
 
 
 
 
函数名: access
功  能: 确定文件的访问权限
用  法: int access(const char *filename, int amode);
程序例:
#include <stdio.h>
#include <io.h>
 
int file_exists(char *filename);
 
int main(void)
{
  printf("Does NOTEXIST.FIL exist: %s\n",
  file_exists("NOTEXISTS.FIL") ? "YES" : "NO");


相关文档:

用C写的读取代码行数。

今天无事,在论坛上一直看贴子,很少动手实践,今天试着写了一个读取源程序代码行数的例子:
现在的代码如下,可能还有不完善的地方,以后再改进:
#include <stdio.h>
#define CHARCOUNT 255
#define CON 6 /*单行注释最少的时候*/
int realLength = 0;
/*
* function name: strCount
* function : count ......

C/C++——小编谈C语言函数那些事(13)

C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
1.       malloc函数
malloc函数的功能是内存分配函数,其用法为:void *malloc(unsigned size);程序实例如下:
#include <stdio.h>
#i ......

C/C++中的按值调用与按引用调用

 许多编程语言中的调用函数的两种方法是按值调用(call-by-value)和按引用调用(call-by-reference)。
参数按值调用传递时,生成参数值副本并且传给被调用函数,副本的改变并不影响调用者的原始变量值,这样就可以防止意外的副作用影响开发正确,可靠的系统。按值调用的一个缺点是,如果传递较大的数据项,则复制这个数 ......

反正切三角函数的c源代码

某些场合,如游戏开发,工程计算中,可能需要计算反三角函数,下面是计算反正切三角函数的c源代码实例:
atan_self(double x)
{
//atan(x)=x-x^3/3+x^5/5-x^7/7+.....(-1<x<1)
//return:[-pi/2,pi/2]
double mult,sum,xx;
sum=0;
if(x==1){
return pi/4;
}
if(x==-1){
return -pi/4;
}
((x&g ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号