[chuck-users] ChucK and STDIN
gewang at CS.Princeton.EDU
Wed Jul 12 16:58:01 EDT 2006
stdin (and file i/o in general) is on the way.
Right now, there are a few hacked/experimental objects we've use
The Skot object: a event-based stdin reader
The PRC object: string tokenizer
They are not in the standard build - you'd have to enable them by adding a
compiler flag: -DAJAY. Which platform are you using? We can post an
executable with these compiled in, if you like.
They will allow one to write code like:
// infinite event loop
while( true )
// prompt and wait
skot.prompt("enter data:") => now;
// get the results
while( skot.more() )
<<< skot.getLine() >>>;
and you can use PRC to tokenize the text.
The actual stdin and file I/O is definitely on the way (thanks to Martin
Robinson), we just haven't integrated/fully tested it yet.
> Where can I look at the actual code that makes up the KBHit event? Is it
> written in C or in ChucK? I'd like to see what that class is actually
> doing (behind the scenes) to watch for the keyboard being pressed.
The KBHit class is implemented in C/C++, in ulib_std.cpp.
> I'm thinking that OSC may be the best way to get around this- but I'm
> not sure. Are there any good intro docs/examples for using OSC (besides,
> the docs on OSC's homepage)?
You probably already found these:
More information about the chuck-users