How to read/write from/to console.