⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 builder.c

📁 别人的根据linux0.11改的一个小的操作系统
💻 C
字号:
/* * Builder.c * * Author : Ming Pengli * Date : * * Description: This routine build the biniary system image file . *              At here ,we knew the start address at 0x1000,so we  *              directly locate the position that we will read.  */#include <stdio.h>#include <stdlib.h>#include <fcntl.h>#include <io.h>#include <unistd.h>int main(int argc,char **argv){	FILE *in,*out;	char ch;	if(argc!=3){		printf("Usage:builder src_file dest_file");		return 0;	}	if((in=fopen(argv[1],"rb"))==NULL){                /* Open the .exe file as read and biniary. */		printf("open input file error...\n");		return 0;	}	fseek(in,0x1000,SEEK_SET);                         /* The _TEXT segment start at 0x1000 */	if((out=fopen(argv[2],"wb"))==NULL){               /* Create a new .bin file */		printf("open output file error...\n");		return 0;	}	while(!feof(in)){                                  /* Read from .exe file,and write into .bin file */		ch=getc(in);		putc(ch,out);	}	fclose(in);	fclose(out);	return 0;}

⌨️ 快捷键说明

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