fdump.c

来自「linux数字电视播放器,比先的版本高一些.」· C语言 代码 · 共 44 行

C
44
字号
#include <asm/types.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <stdio.h>#include <stdlib.h>staticvoid fdump (char *name){	unsigned char buf [8];	int i, fd, count, bytes;	if ((fd = open (name, O_RDONLY)) < 0) {		perror ("open");		exit (-1);	}	printf ("\nu8 %s [] __initdata = {", name);	while ((count = read (fd, buf, sizeof(buf))) > 0) {		printf ("\n\t");		for (i=0;i<count;i++, bytes++)			printf ("0x%02x, ", buf[i]);	}	printf ("\n};\n\n");	close (fd);}int main (void){	printf ("\n#include <asm/types.h>\n");	fdump ("Dpram");	fdump ("Root");	return 0;}

⌨️ 快捷键说明

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