Author |
Message |
aldreneo
|
Posted: Tue May 02, 2006 9:58 pm Post subject: Return the output of a program |
|
|
Is it possible to return the output of a program with sys? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Delos
![](http://www.members.shaw.ca/rfolz/delos_avatar.gif)
|
Posted: Tue May 02, 2006 10:26 pm Post subject: (No subject) |
|
|
Hi. Rats live on no evil star.
Now, please be more specific in what you're asking. Questions like yours are vague and unfulfilling. They will get no useful answers. None whatsoever. What do you mean "the output". What do you mean by "sys"? Are you referring to Sys.Nargs() perhaps?
If you have specific code associated with this question, please either attach it or post it using [code] tags. |
|
|
|
|
![](images/spacer.gif) |
aldreneo
|
Posted: Wed May 03, 2006 4:01 pm Post subject: (No subject) |
|
|
Ok....
How do I make it:
code: |
var command:string
get command
if not Sys.Exec (command) as (var output:string)then
put "Error"
end if
put output
|
So that whatever program that is run it returns the output of the program into the string?
such as
code: |
---EXAMPLE---
ping google.ca
Pinging google.com [64.233.187.99] with 32 bytes of data:
Reply from 64.233.187.99: bytes=32 time=55ms TTL=239
Reply from 64.233.187.99: bytes=32 time=101ms TTL=239
Reply from 64.233.187.99: bytes=32 time=118ms TTL=239
Reply from 64.233.187.99: bytes=32 time=108ms TTL=239
Ping statistics for 64.233.187.99:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 55ms, Maximum = 118ms, Average = 95ms
---END OF EXAMPLE---
| [/code] |
|
|
|
|
![](images/spacer.gif) |
GlobeTrotter
|
Posted: Wed May 03, 2006 4:17 pm Post subject: (No subject) |
|
|
I'm pretty sure that that is not directly possible. You can probably do a workaround though. There are system calls that write to a file, right? So write that system call to a file and then use turing to open up the file it creates. |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: Wed May 03, 2006 4:21 pm Post subject: (No subject) |
|
|
ok, so you want to read stdout of another program?
I don't think that's something that Turing does. Sys.Exec sends out a request to execute a command.
Your best bet is to ether pass a parameter to the program to output to a file instead (so you can read the file) or have it piped to a C or Java program that would save output to file. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
codemage
![](http://usera.imagecave.com/codemage/codemage-small.gif)
|
Posted: Thu May 04, 2006 8:05 am Post subject: (No subject) |
|
|
Heh. Rats. That's clever.
Stressed? No tips? Spit on desserts! |
|
|
|
|
![](images/spacer.gif) |
|