mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Creation of file
This commit is contained in:
parent
c5a885dcd6
commit
2f5add4d5f
@ -372,7 +372,7 @@ class BinaryIO {
|
|||||||
std::cout << GridLogMessage <<"IOobject: C++ read I/O " << file << " : "
|
std::cout << GridLogMessage <<"IOobject: C++ read I/O " << file << " : "
|
||||||
<< iodata.size() * sizeof(fobj) << " bytes" << std::endl;
|
<< iodata.size() * sizeof(fobj) << " bytes" << std::endl;
|
||||||
std::ifstream fin;
|
std::ifstream fin;
|
||||||
fin.open(file, std::ios::binary | std::ios::in);
|
fin.open(file, std::ios::binary | std::ios::in);
|
||||||
if (control & BINARYIO_MASTER_APPEND)
|
if (control & BINARYIO_MASTER_APPEND)
|
||||||
{
|
{
|
||||||
fin.seekg(-sizeof(fobj), fin.end);
|
fin.seekg(-sizeof(fobj), fin.end);
|
||||||
@ -453,11 +453,15 @@ class BinaryIO {
|
|||||||
std::ofstream fout;
|
std::ofstream fout;
|
||||||
fout.exceptions ( std::fstream::failbit | std::fstream::badbit );
|
fout.exceptions ( std::fstream::failbit | std::fstream::badbit );
|
||||||
try {
|
try {
|
||||||
fout.open(file,std::ios::binary|std::ios::out|std::ios::in);
|
if (offset) { // Must already exist and contain data
|
||||||
|
fout.open(file,std::ios::binary|std::ios::out|std::ios::in);
|
||||||
|
} else { // Allow create
|
||||||
|
fout.open(file,std::ios::binary|std::ios::out);
|
||||||
|
}
|
||||||
} catch (const std::fstream::failure& exc) {
|
} catch (const std::fstream::failure& exc) {
|
||||||
std::cout << GridLogError << "Error in opening the file " << file << " for output" <<std::endl;
|
std::cout << GridLogError << "Error in opening the file " << file << " for output" <<std::endl;
|
||||||
std::cout << GridLogError << "Exception description: " << exc.what() << std::endl;
|
std::cout << GridLogError << "Exception description: " << exc.what() << std::endl;
|
||||||
std::cout << GridLogError << "Probable cause: wrong path, inaccessible location "<< std::endl;
|
// std::cout << GridLogError << "Probable cause: wrong path, inaccessible location "<< std::endl;
|
||||||
#ifdef USE_MPI_IO
|
#ifdef USE_MPI_IO
|
||||||
MPI_Abort(MPI_COMM_WORLD,1);
|
MPI_Abort(MPI_COMM_WORLD,1);
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user