opening stdin in constructor