testopen.c

来自「通过把彩票每期的重奖号码保存在文件中」· C语言 代码 · 共 42 行

C
42
字号
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
void hanzi16(int x,int y,char *s,int colour);
void main()
{
	FILE *fp;
	int gdriver,gmode;
	initgraph(&gdriver,&gmode,"EGAVGA.BGI");
	hanzi16(100,100,"你好",10);
}
void hanzi16(int x,int y,char *s,int colour)
{
 FILE *fp;
 char buffer[32];                  
 register i,j,k;
 unsigned char qh,wh;
 unsigned long location;
 if((fp=fopen("hzk16","rb"))==NULL)
  {
   printf("Cant open hzk16!");
   getch();
   exit(0);
  }
 while(*s)
  {
   qh=*s-0xa0;
   wh=*(s+1)-0xa0;
   location=(94*(qh-1)+(wh-1))*32L;   
   fseek(fp,location,SEEK_SET);
   fread(buffer,32,1,fp);
   for(i=0;i<16;i++)
    for(j=0;j<2;j++)
     for(k=0;k<8;k++)
      if(((buffer[i*2+j]>>(7-k))&0x1)!=NULL)
       putpixel(x+8*j+k,y+i,colour);
   s+=2;
   x+=16;                              
  }
 fclose(fp);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?