-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use std::istream in the usage demo #34
base: master
Are you sure you want to change the base?
Conversation
In README.md
#include "Reader.hpp" | ||
|
||
... | ||
|
||
FILE* f = fopen("test.mae", "r"); | ||
FILE* f = std::istream("test.mae", "r"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 24 to 30 in 05fb831
Reader(FILE* file, size_t buffer_size = BufferLoader::DEFAULT_SIZE); | |
Reader(std::shared_ptr<std::istream> stream, | |
size_t buffer_size = BufferLoader::DEFAULT_SIZE); | |
Reader(const std::string& fname, | |
size_t buffer_size = BufferLoader::DEFAULT_SIZE); |
Therefore,
#include <fstream>
auto f = std::make_shared<std::ifstream>("test.mae");
Or pass by std::string
as @JarrettSJohnson commented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to drop the file pointer altogether and use:
schrodinger::mae::Reader r{"test.mae"};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diff --git a/README.md b/README.md
index dd2ee02dcc30..c6a6c9ee92d0 100644
--- a/README.md
+++ b/README.md
@@ -26 +25,0 @@ while ((b = r.next("f_m_ct")) != nullptr) {
-fclose(f);
In README.md