?? makefile.c
字號:
// Hero Tech. Copyright 2007 by AlexMozh
/* My 200 In 1 Make files to one File */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <process.h>
#include <dos.h>
#include <io.h>
#include <time.h>
#include <sys\timeb.h>
int main()
{
FILE *fp,*fromfp;
int i,j,k;
long unitlen=2048;
long baseadd=0x1000;
char filename[128]={"kov.zip"};
char fromname[128]={"sre.bmp"};
char buf[2048];
unsigned attrib,old_attr;
long len,adds;
// ========== Change file attrib named by <filename> ========
if (_dos_getfileattr(filename,&attrib) != 0)
return 1;
old_attr=attrib;
if (attrib & _A_RDONLY)
{
attrib &= ~_A_RDONLY;
_dos_setfileattr(filename,attrib);
}
if ((fp=fopen(filename,"r+b"))==NULL)
{
return 1 ;
}
// ========== Put the file sre.bmp to file named by <filename> =====
if ((fromfp=fopen(fromname,"rb"))==NULL)
{
return 1 ;
}
len=filelength(fileno(fromfp));
adds=baseadd+0x1000;
fseek(fp,baseadd,SEEK_SET);
fwrite(&adds,4,1,fp);
fwrite(&len,4,1,fp);
fseek(fp,adds,SEEK_SET);
j=len / unitlen;
k=len % unitlen;
for (i=0;i<j;i++)
{
fread(buf,unitlen,1,fromfp);
fwrite(buf,unitlen,1,fp);
fwrite(buf,1,1,fp);
}
if (k>0)
{
fread(buf,k,1,fromfp);
fwrite(buf,k,1,fp);
}
fclose(fromfp);
// ========== Put the file <alexme.exe> to file named by <filename> =====
strcpy(fromname,"alexme.exe");
if ((fromfp=fopen(fromname,"rb"))==NULL)
{
return 1 ;
}
adds=(((adds+len+j) / 0x1000)+1)*0x1000;
len=filelength(fileno(fromfp));
fseek(fp,baseadd+8,SEEK_SET);
fwrite(&adds,4,1,fp);
fwrite(&len,4,1,fp);
fseek(fp,adds,SEEK_SET);
j=len / unitlen;
k=len % unitlen;
for (i=0;i<j;i++)
{
fread(buf,unitlen,1,fromfp);
fwrite(buf,unitlen,1,fp);
}
if (k>0)
{
fread(buf,k,1,fromfp);
fwrite(buf,k,1,fp);
}
fclose(fromfp);
fclose(fp);
_dos_setfileattr(filename,old_attr);
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -