Gast
#4568301
kann mir jemand bitte das in C übersetzen?? bin nicht so gut in C
vielen dank im voraus
void FileAR(string filename,bool x)
{
fstream file(filename.c_str(),ios::in | ios::out | ios::binary);
if(!file)
{
cout <<"Could not open file";
return;
}
unsigned size;
file.seekg(0,ios::end);
size=file.tellg();
file.seekg(ios::beg);
file.clear();
unsigned pos;
int n_blocks=size/BLOCK_SIZE;
if(size%BLOCK_SIZE!=0)
++n_blocks;
for(int i=0;i<n_blocks;i++)
{
unsigned char data[BLOCK_SIZE];
pos=file.tellg();
file.read((char*)data,BLOCK_SIZE); // read data block
---
file.seekp(pos);
file.write((char*)data,BLOCK_SIZE);
memset(data,0,BLOCK_SIZE);
}
file.close();
}