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

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

 C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
 
1.       parsfnm函数
 
parsfnm函数的功能是分析文件名,其用法为:char *parsfnm (char *cmdline, struct fcb *fcbptr, int option);程序实例如下:
#include <process.h>
#include <string.h>
#include <stdio.h>
#include <dos.h>
int main(void)
{
   char line[80];
   struct fcb blk;
   printf("Enter drive and file name (no path - ie. a:file.dat)\n");
   gets(line);
   if (parsfnm(line, &blk, 1) == NULL)
      printf("Error in parsfm call\n");
   else
      printf("Drive #%d  Name: %11s\n", blk.fcb_drive, blk.fcb_name);
   return 0;
}
2.      peek函数
 
peek函数的功能是检查存储单元,其用法为:int peek(int segment, unsigned offset);程序实例代码如下:
#include <stdio.h>
#include <conio.h>
#include <dos.h>
int main(void)
{
   int value = 0;
   printf("The current status of your keyboard is:\n");
   value = peek(0x0040, 0x0017);
   if (value & 1)
      printf("Right shift on\n");
   else
      printf("Right shift off\n");
   if (value & 2)
      printf("Left shift on\n");
   else
      printf("Left shift off\n");
   if (value & 4)
      printf("Control key on\n");
   else
      printf("Control key off\n");
   if (value & 8)
      printf("Alt key on\n");
   else
      printf("Alt key off\n");
   if (value & 16)
  &nb


相关文档:

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

C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
 
1. kbhit函数
 
kbhit函数是检查当前按下的键,其用法为:int kbhit(void);程序例子如下:
#include <conio.h>
int main(void)
{
   c ......

zz Emacs C

日期:2009-11-21   10:54:22
本节主要参考:
    曹乐的《在Emacs下用C/C++编程》
    王纯业的《Emacs 一个强大的平台》
    emacswiki.org
emcas难学易用,可扩展性强。有人把她当作信仰,有人认为他是魔鬼!学习首先记住基本的键盘快捷键,学会常用插件, ......

C字符串操作函数源码

 
#ifndef _PPC_BOOT_STRING_H_
#define _PPC_BOOT_STRING_H_
#include <stddef.h>
extern char *strcpy(char *dest, const char *src);
extern char *strncpy(char *dest, const char *src, size_t n);
extern char *strcat(char *dest, const char *src);
extern int strcmp(const char *s1, const cha ......

用C写的读取代码行数。

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

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

C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
1.       ldexp函数
ldexp函数的功能是计算value*2的幂,其用法为:double ldexp(double value, int exp);程序实例如下:
    ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号