HowTo tell a C-written prog comandline-paramters and get stdout

I wrote a C-program “iButton”, which reads an USB-Adapter. I would like to start this program via AppleScript and set some command-line parameters.
“iButton 12 34 56”
iButton sends its data to stdout.
Is there a way to collect this data into AppleScript?
Thank you

Try this:

set re_sult to (do shell script "iButton 12 34 56")

If your iButton program produces its output and exits before you want to process the output back in AppleScript, then you can use the do shell script command from the StandardAdditions OSAX:

set iButtonOutput to do shell script "/path/to/your/iButton/program 12 34 56"
-- process the contents of iButtonOutput

If iButton runs indefinitely, or you want to read and process its output before it has exited, then there is no simple way. My best idea is to use do shell script to redirect your program’s output (stdout and stderr) to files and run it “in the background” (with respect to do shell script), then use StandardAddtion’s read from AppleScript.

If you need to feed extra input to your program while it is running, you could take the next step and attach its stdin to a named pipe (when it is launched) and use StandardAddition’s write to push in extra data in through the named pipe while the program is running. Beware of deadlocks.

Chris, thanks for this hint: It works fine!