Random replication hard disk, can prevent the general data recovery???
1#include <stdio.h>2#include <stdlib.h>3#include <string.h>4 5 #defineFile_size (1024 * 1024 * 1)6 #defineFile_count (1 * 100)7 #defineFck_loop (3)8 9 intMainvoid)Ten { OneFILE *FP =NULL; A Charfile_name[ +]; -UnsignedChar*data =NULL; - intI, J, Len, Fck_loop; the -data = (unsignedChar*)malloc(file_size); - if(Data = =NULL) - { +printf"malloc%d error!! \ n", i); - Gotoend; + } A atFck_loop =0; - while(Fck_loop <fck_loop) - { - //For (i = 0; i < File_count; i++) -i =0; - while(1) in { - if(Fck_loop = =0) to { +memset (data,0x00, file_size); - } the Else if(Fck_loop = =1) * { $memset (data,0xFF, file_size);Panax Notoginseng } - Else the { +Srand (i ^0x835); A the for(j =0; J < File_size; J + +) + { -DATA[J] = rand ()%0xFF; $ } $ } - - thesnprintf (file_name,sizeof(file_name)-1,"fck_file_%08d", i); -printf"%s\n", file_name);Wuyi thefp = fopen (file_name,"w+"); - if(fp = =NULL) Wu { -printf"Create%s error!! \ n", file_name); About //Goto end; $ Break; - } - -Len = fwrite (data,1, File_size, FP); A //printf ("Fwrite len:%d\n", Len); + if(Len! = file_size *1) the { -printf"Write%s error!! \ n", file_name); $ //Goto end; the Break; the } the the fclose (FP); -i++; in } theSystem"del fck_file_*"); thefck_loop++; About } the Free(data); the the End: + return 0; -}
Random replication hard disk, can prevent the general data recovery???