-
-
Notifications
You must be signed in to change notification settings - Fork 129
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 fgets()
for reading from stdin
and a temporay buffer to read from file
#4021
Conversation
fgets()
for reading from console and fread()
to read char
from filefgets()
for reading from stdin
and fread()
to read n
characters from file
fgets()
for reading from stdin
and fread()
to read n
characters from filefgets()
for reading from stdin
and fread()
to read from file
The following tests FAILED:
282 - intrinsics_60 (Failed)
669 - file_03 (Failed)
|
Tests have to pass. |
The approach used in this PR seems fine to me. @kmr-srbh you just need to get the tests to pass. Just strip down the failing tests (for example |
We now read files character by character skipping whitespaces. Padding input from stdin with spaces is implemented now too. However, the integration tests |
This implementation is now complete. |
The Windows test fails unexpectedly. |
fgets()
for reading from stdin
and fread()
to read from filefgets()
for reading from stdin
and a temporay buffer to read from file
The Windows build error must be investigated. I am guessing some of the new functions that you use do not work on Windows. |
@certik this PR is now ready. |
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.
I think that this is fine, thanks!
fixes #4015
Use
fgets()
to readn
characters fromstdin
wheren
is the length of the variable which will store the data. When reading from a file, we use a temporary buffer to store the whole data. Post this, we add the required chunk of data to the main buffer.Console read
Output on main
Output on branch
File read
Content of
hello.txt
isOutput on main
Output on branch