function to open stdin