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

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

C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
 
1.     setfillpatterne函数
setfillpatterne函数的功能是选择用户定义的填充模式,其用法为:void far setfillpattern(char far *upattern, int color);程序实例如下:
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
int main(void)
{
    int gdriver = DETECT, gmode, errorcode;
   int maxx, maxy;
   char pattern[8] = {0x00, 0x70, 0x20, 0x27, 0x24, 0x24, 0x07, 0x00};
   initgraph(&gdriver, &gmode, "");
   errorcode = graphresult();
   if (errorcode != grOk) 
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1);
   }
   maxx = getmaxx();
   maxy = getmaxy();
   setcolor(getmaxcolor());
   setfillpattern(pattern, getmaxcolor());
   bar(0, 0, maxx, maxy);
   getch();
   closegraph();
   return 0;
}
 2.   setftime函数
setftime函数的功能是设置文件日期和时间,其用法为int setftime(int handle, struct ftime *ftimep);程序实例代码如下:
#include <stdio.h>
#include <process.h>
#include <fcntl.h>
#include <io.h>
int main(void)
{
   struct ftime filet;
   FILE *fp;
   if ((fp = fopen("TEST.$$$", "w")) == NULL)
   {
      perror("Error:");
      exit(1);
   }
   fprintf(fp, "testing...\n");
   filet.ft_tsec = 1;
   filet.ft_min = 1;
   filet.ft_hour = 1;
   filet.ft_day = 1;
  


相关文档:

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

 C程序是由一组或是变量或是函数的外部对象组成的。 函数是一个自我包含的完成一定相关功能的执行代码段。下面小编和大家分享下C语言中的函数。
 
1.       parsfnm函数
 
parsfnm函数的功能是分析文件名,其用法为:char *parsfnm (char *cmdline, struct fcb *fcbptr, ......

混凝土强度评定系统1.1 c代码

#define NULL 0
#define LEN 10
#define OK printf("\n此组数据合格。\n")
#define NO printf("\n此组数据不合格!\n")
#define CN printf("\n%30c 伟成工作室荣誉出品 %c\n",17,16)
#include "stdlib.h"
#include "math.h"
static float min,ave;       
float *zwfloat(void ......

c # 4.0

c# 4.0新特性一览
终于静下心来仔细听了一遍Anders Hejlsberg(Visual Studio组的TECHNICAL FELLOW,C#的设计者之一)在PDC08上讲的“The Future of C#”(http://channel9.msdn.com/pdc2008/TL16/)。
回顾C#发展的历史,C#1.0完全是模仿Java,并保留了C/C++的一些特性如struct,新学者很容易上手;C#2.0加入 ......

[随想]C/C++程序员

       刚刚看过这篇《30 years of C》,回想了这几年的学习历程。
      在大学里,我学习的第一门程序设计语言是C,但花时间最多的还是C++。大约五年前,开始啃《 C++编程思想》两卷本,用Dev-cpp在机器练习着书上的一个个例子程序,之后又学习了面向对象编程、STL、模板。凭着 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号