Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
CondCore
DBCommon
src
FileUtils.cc
Go to the documentation of this file.
1
#include "
CondCore/DBCommon/interface/FileUtils.h
"
2
#include "
CondCore/DBCommon/interface/Exception.h
"
3
#include <fstream>
4
#include <sstream>
5
6
bool
cond::FileReader::read
(
const
std::string&
fileName
){
31
std::ifstream
inputFile
;
32
inputFile.open (fileName.c_str());
33
if
(!inputFile.good()){
34
std::stringstream
msg
;
35
msg <<
"File \""
<< fileName <<
"\" cannot be open."
;
36
inputFile.close();
37
throw
cond::Exception
(msg.str());
38
}
39
// get pointer to associated buffer object
40
std::filebuf* pbuf=inputFile.rdbuf();
41
// get file size using buffer's members
42
long
size
=pbuf->pubseekoff (0,
std::ios::end
,
std::ios::in
);
43
pbuf->pubseekpos (0,
std::ios::in
);
44
// allocate memory to contain file data
45
char
* buffer=
new
char
[size+1];
46
// get file data
47
pbuf->sgetn (buffer,size);
48
inputFile.close();
49
buffer[
size
]=0;
50
m_content
+= buffer;
51
delete
[] buffer;
52
return
true
;
53
}
runTheMatrix.msg
string msg
Definition:
runTheMatrix.py:618
recoMuon::in
Definition:
RecoMuonEnumerators.h:6
cond::FileReader::m_content
std::string m_content
Definition:
FileUtils.h:21
convertXMLtoSQLite_cfg.fileName
tuple fileName
Definition:
convertXMLtoSQLite_cfg.py:12
Exception.h
cond::FileReader::read
bool read(const std::string &fileName)
Definition:
FileUtils.cc:6
FileUtils.h
analyzePatCleaning_cfg.inputFile
tuple inputFile
Definition:
analyzePatCleaning_cfg.py:6
end
#define end
Definition:
vmac.h:38
edm::hlt::Exception
error
Definition:
HLTenums.h:24
findQualityFiles.size
tuple size
Write out results.
Definition:
findQualityFiles.py:322
Generated for CMSSW Reference Manual by
1.8.5