https://www.somethingsblog.com/2024/10/19/clearing-i-o-errors-in-c-the-clearerr-function/