Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

d-b-w
Copy link
Collaborator

@d-b-w d-b-w commented Mar 29, 2019

In README.md

@d-b-w d-b-w requested a review from torcolvin March 29, 2019 23:11
#include "Reader.hpp"

...

FILE* f = fopen("test.mae", "r");
FILE* f = std::istream("test.mae", "r");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maeparser/Reader.hpp

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.

Copy link
Member

@JarrettSJohnson JarrettSJohnson left a 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"};

Copy link
Contributor

@e-kwsm e-kwsm left a 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);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants