阅读背景:

尝试将位图文件读取为十六进制

来源:互联网 
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#define NBRCOLOURS 16
#define COLOURSIZE 8

typedef struct
{
    char colours[COLOURSIZE];

}BITMAP;



//Main Function
void main(void)
{
    int count, count2;
    char bm_file[] = "C:\Coding\Bitmap Program\Sample.bmp";
    FILE *fptr;
    char ch;
    int i = 0;
    BITMAP bm_data[NBRCOLOURS];


    fptr = fopen(bm_file, "rb");
    if (fptr != NULL)
    {
        while ((ch = fgetc(fptr)) != EOF)
        {
            printf("%02X ", ch);
            if (!(++i % 16)) putc('\n', stdout);
        }
    }

    fclose(fptr);

    system("pause");
    return;
}
#include <stdio.h>
#include <string.h>
#include



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: