include
include
include
include
include <sys/stat.h>
include
void test_copy_binary(std::string src,std::string dst){
std::ofstream ostrm(dst,std::ios::binary);
std::ifstream istrm(src,std::ios::binary);
if (!istrm.is_open() )
{
std::cout<<"failed to open: "<<src<<std::endl;
return ;
}
if (!ostrm.is_open())
{
std::cout<<"failed to open: "<<dst<<std::endl;
return ;
}
{
char buf[1];
while(1){
istrm.read(buf,1);
if(istrm.eof())
{
break;
}
ostrm.write(buf,1);
istrm.seekg(1024);
}
istrm.close();
ostrm.close();
}
}
标签:std,binary,ofstream,string,dst,ifstreram,cpp,include
From: https://www.cnblogs.com/simp/p/16803377.html