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

Add flush after printf #32

Open
vletoux opened this issue Jun 22, 2021 · 2 comments
Open

Add flush after printf #32

vletoux opened this issue Jun 22, 2021 · 2 comments

Comments

@vletoux
Copy link
Contributor

vletoux commented Jun 22, 2021

Thanks for this excellent tool !

I tried to add a GUI over WinPmem for end user by redirecting stdin and stdout.

Short version: the output get buffered all at once when the program is terminating under a non console program.
Which prohibits display console information provided by WinPmem when the work is in progress.

After a lot of investigation, I found out this article https://www.codeproject.com/Articles/16163/Real-Time-Console-Output-Redirection which points that under a pipe, the flush behavior of printf under MS C lib is changed when there is no console behind.

This problem will be fixed if a flush is added after each printf.

@vivianezw
Copy link
Collaborator

Thank you, this is a very interesting observation. I observed similar things with stdin/out and pipes and maybe hit a brick wall. A flush can't hurt and maybe it prevents some of these strange effects. WriteConsole also seems to avoid a lot of issues which printf has sometimes.

I don't have time at the moment. Maybe you could do a pull request?

@vletoux
Copy link
Contributor Author

vletoux commented Jun 29, 2021

Done (#34 )

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