huili2astyle alldc3fae412 years agoHistory
24 lines · 531 B · C
RawDownload
#ifndef __FILEINPUTSTREAM_H__#define __FILEINPUTSTREAM_H__ #include <fstream>#include "InputStream.h" class FileInputStream : public InputStream { public:  bool Open (const char* fileName) {    file_.open (fileName, std::ios_base::in | std::ios_base::binary);    return file_.is_open();  }  int read (void* ptr, size_t len) {    if (!file_.good()) {      return -1;    }    file_.read (static_cast<char*> (ptr), len);    return file_.gcount();  } private:  std::ifstream file_;}; #endif //__FILEINPUTSTREAM_H__

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t