the bug is here: you need to open it as non-binary: `f.open(name, "r");`