for windows we must open files in O_BINARY mode