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

Fix wrong usage of feof #9

Merged
merged 1 commit into from
Feb 15, 2020
Merged

Fix wrong usage of feof #9

merged 1 commit into from
Feb 15, 2020

Conversation

markand
Copy link
Contributor

@markand markand commented Feb 15, 2020

Hi,

The C function feof can only be used after at least one I/O operation and cannot be used immediately after fopen.

This is a common mistake that I simply fixed by checking the result of fgets which is usually enough.

While here, since the function always return 0 and its result code is never tested I simply removed it and reduced indent level.

@markand markand requested a review from orhun February 15, 2020 11:05
@orhun orhun added the enhancement New feature or request label Feb 15, 2020
@orhun
Copy link
Owner

orhun commented Feb 15, 2020

Hey,

Thanks for pointing out and fixing this issue.
Also it's good to learn this detail 👍

@orhun orhun merged commit 46856ab into orhun:master Feb 15, 2020
@markand markand deleted the fix-feof branch February 17, 2020 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants