Thread View: cn.bbs.comp.program
1 messages
1 total messages
Started by Sheep
Wed, 19 Aug 1998 00:00
Re: DOS�µ�C++��UNIX�µ�C++�ı�������?
Author: Sheep
Date: Wed, 19 Aug 1998 00:00
Date: Wed, 19 Aug 1998 00:00
65 lines
3237 bytes
3237 bytes
> [1;36m==> A_A(�����۾���һ��) ˵��: [37;40m[0m
> �ղ���short int, Ȼ��������˵��unsigned short, ������
> һ�����������, 2+4+2+2+4=16? ����, �����Ժ���.
~~~~~~~~~~~~~
Ӧ����ΪѰַ���㣬ʹ����
�����ʽ��
2+XX+4+2+2+4,��ʹ����
˫��Ѱַ���㡣
> #include <stdio.h>
> #include <unistd.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> typedef struct tagBITMAPFILEHEADER { /* bmfh */
> unsigned short bfType;
~~~~~~~~~~~~~~~~~~~~~~
unsigned char bfType[2];
�����Ÿij����ϣ���Ϊ16��//sigh
> unsigned long bfSize;
> unsigned short bfReserved1;
> unsigned short bfReserved2;
> unsigned long bfOffBits;
> } BITMAPFILEHEADER;
> typedef struct tagBITMAPINFOHEADER { /* bmih */
> unsigned long biSize;
> unsigned long biWidth;
> unsigned long biHeight;
> unsigned short biPlanes;
> unsigned short biBitCount;
> unsigned long biCompression;
> unsigned long biSizeImage;
> unsigned long biXPelsPerMeter;
> unsigned long biYPelsPerMeter;
> unsigned long biClrUsed;
> unsigned long biClrImportant;
> } BITMAPINFOHEADER;
> typedef struct tagRGBBIT { /* rgbq */
> unsigned char rgbBlue;
> unsigned char rgbGreen;
> unsigned char rgbRed;
> } RGBBIT;
> int main(void)
> {
> printf("size of char: %d\n",sizeof(unsigned char));
> printf("size of unsigned short: %d\n",sizeof(unsigned short));
> printf("size of unsigned long: %d\n",sizeof(unsigned long));
> printf("size of BITMAPFILEHEADER: %d\n",sizeof(BITMAPFILEHEADER));
> printf("size of BITMAPINFOHEADER: %d\n",sizeof(BITMAPINFOHEADER));
> printf("size of RGBBIT: %d\n",sizeof(RGBBIT));
> return 0;
> }
> // ----------------- End of File -----------------------------
> ������:
> size of char: 1
> size of unsigned short: 2
> size of unsigned long: 4
> size of BITMAPFILEHEADER: 16
> size of BITMAPINFOHEADER: 40
> size of RGBBIT: 3
> ��Ҫ������. ��~~~
���÷�ɣ���һ�±�������Ƿ���Ѹ��Ż�ȥ����
��������Ķ�����Ҳ��Ҫ��Ҫ����ṹ�ˣ�����������ȥ�ɣ�//xixi
--
�� ��Դ: �й�ƴ�BBSվ [bbs.ustc.edu.cn]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads