Hébergement
Forum
#include <stdio.h>
#define header_lg 8
char header[header_lg] = {
0x89 ,0x50 ,0x4e ,0x47 ,0xd ,0xa ,0x1a ,0xa };
int main (int argc, char *argv[])
{
char buf[header_lg];
file *in;
char devnull[8];
unsigned char w=0,w1=0,h=0,h1=0,w2=0,w3=0,h2=0,h3=0;
if ( argc < 2 ) { printf("png_info <filename>\n"); exit(0);}
if((in = fopen(argv[1],"rb"))== null){
printf("impossible a ouvrir: \n",argv[1]);
exit(0);
}
fread(buf,1,header_lg,in);
if ( memcmp(buf, header, header_lg) ) {
printf("mauvais entete \n");
exit(1);
}
fread(devnull,1,8,in);
fread(&w,1,1,in);
fread(&w1,1,1,in);
fread(&w2,1,1,in);
fread(&w3,1,1,in);
fread(&h,1,1,in);
fread(&h1,1,1,in);
fread(&h2,1,1,in);
fread(&h3,1,1,in);
printf("%s width=\"%d\" height=\"%d\"\n",argv[1],
(w1+256*w)*256+w3+256*w2,
(h1+256*h)*256+h3+256*h2);
fclose(in);
}
| Youhp3 | Youpee est un preprocesseur HTML pour vous simplifier toutes les tâches répétitives dans la création d'un site web. Salemioche.net utilise trés largement ses possibilités |
| cygwin | le compilateur gcc sous windows ainsi que tous les outils unix (awk, grep, sed, bash, ksh ...) |