/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2019 EQUA Simulation AB
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
Application
testFiles
Description
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "OSspecific.H"
#include "clockTime.H"
#include
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
argList::validArgs.insert("file1");
argList::validArgs.insert("file2");
argList args(argc, argv, false, true);
const fileName file1 = args[1];
const fileName file2("out1");
const fileName file3("out2");
clockTime T;
T.timeIncrement();
Foam::cp(file1,file2);
Info << "Foam::cp elapsed time = " << T.timeIncrement() << endl;
std::ifstream f1(file1);
std::ofstream f3(file3);
const size_t L = 256;
char* buffer = new char[L];
while (!f1.eof()) {
f1.read(buffer, L);
f3.write(buffer, f1.gcount());
}
Info << "Buffered rd/wt elapsed time = " << T.timeIncrement() << endl;
Info << "after rdbuf eof = " << f1.eof() << endl;
return 0;
}
// ************************************************************************* //