MCPcopy Create free account
hub / github.com/arq5x/bedtools2 / Open

Method Open

src/utils/bedFile/bedFile.cpp:115–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113
114
115void BedFile::Open(void) {
116
117 _bedFields.reserve(12);
118
119 if (bedFile == "stdin" || bedFile == "-") {
120 _bedStream = &cin;
121 }
122 else {
123 _bedStream = new ifstream(bedFile.c_str(), ios::in);
124
125 if( isGzipFile(_bedStream) ) {
126 delete _bedStream;
127 _bedStream = new igzstream(bedFile.c_str(), ios::in);
128 }
129 if ( _bedStream->fail() ) {
130 cerr << "Error: The requested file ("
131 << bedFile
132 << ") "
133 << "could not be opened. "
134 << "Error message: ("
135 << strerror(errno)
136 << "). Exiting!" << endl;
137 exit (1);
138 }
139 }
140 // save the file's header (if there is one)
141 GetHeader();
142}
143
144// Rewind the pointer back to the beginning of the file
145void BedFile::Rewind(void) {

Callers

nothing calls this directly

Calls 3

isGzipFileFunction · 0.85
reserveMethod · 0.80
c_strMethod · 0.45

Tested by

no test coverage detected