Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
}
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:13
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:255
Exception.h
producerFileCleanner.msg
string msg
Definition:
producerFileCleanner.py:91
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:37
edm::hlt::Exception
error
Definition:
HLTenums.h:21
findQualityFiles.size
tuple size
Write out results.
Definition:
findQualityFiles.py:442
Generated for CMSSW Reference Manual by
1.8.5