33,311
社区成员
发帖
与我相关
我的任务
分享
//Begin
ULONG ll_size=1024*1024*12*10;
BYTE * l_pBuffer=new BYTE[ll_size];
memset(l_pBuffer,0,ll_size);
//write
string ls_dir="H:\\temp\\";
string ls_ext=".dat";
ULONG ll_start=clock();
ULONG ll_begin,ll_end;
ofstream file_buffer;
for (ULONG ll_n=0;ll_n<3;ll_n++)
{
ll_begin=clock();
string ls_path=ls_dir+num2str(ll_n)+ls_ext;
file_buffer.open(ls_path.c_str(),ios::binary);
for (ULONG ll_i=0;ll_i<1;ll_i++)
{
file_buffer.write((char *)l_pBuffer,ll_size);
}
file_buffer.close();
ll_end=clock();
cout<<(ll_end -ll_begin)/CLOCKS_PER_SEC<<std::endl;
}
system("pause");
for (ULONG ll_n=3;ll_n<6;ll_n++)
{
ll_begin=clock();
string ls_path=ls_dir+num2str(ll_n)+ls_ext;
file_buffer.open(ls_path.c_str(),ios::binary);
for (ULONG ll_i=0;ll_i<1;ll_i++)
{
file_buffer.write((char *)l_pBuffer,ll_size);
}
file_buffer.close();
ll_end=clock();
cout<<(ll_end -ll_begin)/CLOCKS_PER_SEC<<std::endl;
}
ULONG ll_stop=clock();
cout<<"Total:";
cout<<(ll_stop -ll_start)/CLOCKS_PER_SEC<<std::endl;
system("pause");