Commit 8458394226d6d17cddb7c1e5c479167bdb03943a

Authored by Pavel Govyadinov
2 parents 3bd72370 ba72c5b0

Merge remote-tracking branch 'origin' into Branch_Detection

Showing 1 changed file with 10 additions and 0 deletions   Show diff stats
stim/envi/binary.h
... ... @@ -71,6 +71,16 @@ protected:
71 71 //open the file as binary for reading and writing
72 72 file.open(filename.c_str(), std::ios::in | std::ios::out | std::ios::binary);
73 73  
  74 + //if the file isn't open, the user may only have read access
  75 + if(!file.is_open()){
  76 + std::cout<<"class BINARY - failed to open file, trying for read only"<<std::endl;
  77 + file.open(filename.c_str(), std::ios::in | std::ios::binary);
  78 + if(!file.is_open()){
  79 + std::cout<<" still unable to load the file"<<std::endl;
  80 + return false;
  81 + }
  82 + }
  83 +
74 84 //if the file is successful
75 85 if(file){
76 86 name = filename; //set the name
... ...