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

Error state when std::getline finds no header #18

Closed
tjgalvin opened this issue Apr 30, 2019 · 3 comments
Closed

Error state when std::getline finds no header #18

tjgalvin opened this issue Apr 30, 2019 · 3 comments

Comments

@tjgalvin
Copy link

This was introduced in #17 .

I've found that when attempting to train a SOM initialized with the a previous SOM output file that there will be readSOM errors raised. Testing the code out I think that the std::getline is getting into an error state as it unsuccessfully searches for the # END OF HEADER string in a file without one. If a file does not contain the # END OF HEADER it will eventually get to the end of a file and attempt to read in a new line, at which point an error is encountered and subsequent seekg will no longer work.

This behavior can be seen by inspecting the is.eof() bit before and after the scan of the header is performed.

Fixing it requires a is.clear() to be added. I am not sure if the problem persists in other areas of the code.

@tjgalvin
Copy link
Author

Created pull request #19 that fixes the issue for my testing

@BerndDoser
Copy link
Member

Thanks for fixing. I had included is.clear() for the images but, unfortunately, forgotten for the SOM.

@tjgalvin
Copy link
Author

tjgalvin commented May 1, 2019

I noticed that after I fixed the readSOM bug. Started wondering why I only saw it with the SOM and not images. If I read that first I would have saved about an hour of debugging!

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

No branches or pull requests

2 participants