examples/string/readline.ck
raw| 1 | // this is really hacked: ConsoleInput class to be replaced soon |
| 2 | |
| 3 | // make a ConsoleInput |
| 4 | ConsoleInput in; |
| 5 | // tokenizer |
| 6 | StringTokenizer tok; |
| 7 | |
| 8 | // loop |
| 9 | while( true ) |
| 10 | { |
| 11 | // prompt |
| 12 | in.prompt( "enter line of text: " ) => now; |
| 13 | |
| 14 | // read |
| 15 | while( in.more() ) |
| 16 | { |
| 17 | // get it |
| 18 | tok.set( in.getLine() ); |
| 19 | // print tokens |
| 20 | while( tok.more() ) |
| 21 | { |
| 22 | // print it |
| 23 | <<< tok.next(), "" >>>; |
| 24 | } |
| 25 | } |
| 26 | } |