changed: - This is a simple example of writing to and reading from a text file: \begin{axiom} f1: TextFile := open("/tmp/test", "output") writeLine!(f1, "abcdefg") close! f1 f2: TextFile := open("/tmp/test", "input") l := readLine! f2 output l close! f2 \end{axiom} Here is a system command. It display how many files there are in the default current directory where Axiom is run. \begin{axiom} )set output algebra on systemCommand("system ls | wc") \end{axiom} Please do not try to list the complete contents of this directory! If you do, MathAction will appear to hang. Here is a shorter list of files that works ok: \begin{axiom} )set output algebra on systemCommand("system ls .. > /tmp/test") \end{axiom} \begin{axiom} f2: TextFile := open("/tmp/test", "input") while not endOfFile? f2 repeat s := readLine! f2 output s close! f2 \end{axiom} Here is an example of how to call a polymake constructor. Notice that you must use the full path name. \begin{axiom} )set output algebra on systemCommand("system /usr/local/polymake/bin/cube /tmp/cube4.poly 4 2>/tmp/cube4.stderr >/tmp/cube4.stdout") \end{axiom} Here is the standard output of the command (if any): \begin{axiom} systemCommand("system cat /tmp/cube4.stdout") \end{axiom} Here is the error output of the command (if any): \begin{axiom} systemCommand("system cat /tmp/cube4.stderr") \end{axiom} Now display the contents of the file that was created: \begin{axiom} f2: TextFile := open("/tmp/cube4.poly", "input") while not endOfFile? f2 repeat s := readLine! f2 output s close! f2 \end{axiom} From kratt6 Fri Aug 26 16:55:21 -0500 2005 From: kratt6 Date: 2005年8月26日 16:55:21 -0500 Subject: Message-ID: <20050826165521-0500@page.axiom-developer.org> \begin{axiom} systemCommand("system /usr/local/polymake/bin/cross /tmp/c4.poly 4") systemCommand("system cat /tmp/c4.poly") \end{axiom}
This is a simple example of writing to and reading from a text file:
(1) -> f1: TextFile := open("/tmp/test","output")
writeLine!(f1,"abcdefg")
close! f1
f2: TextFile := open("/tmp/test", "input")
l := readLine! f2
output l
abcdefg
close! f2
Here is a system command. It display how many files there are in the default current directory where Axiom is run.
)set output algebra on
systemCommand("system ls | wc")
108558 108571 3471506
Please do not try to list the complete contents of this directory! If you do, MathAction will appear to hang.
Here is a shorter list of files that works ok:
)set output algebra on
systemCommand("system ls .. > /tmp/test")
f2: TextFile := open("/tmp/test", "input")
(10) "/tmp/test"
while not endOfFile? f2 repeat s := readLine! f2 output s
Data.fs Data.fs.index Data.fs.lock Data.fs.old Data.fs.tmp LatexWiki README.txt Z2.lock Z2.pid graphviz.pdf.xml pts revisions.xml x.png zopectlsock
close! f2
(12) "/tmp/test"
Here is an example of how to call a polymake constructor. Notice that you must use the full path name.
)set output algebra on
systemCommand("system /usr/local/polymake/bin/cube /tmp/cube4.poly 4 2>/tmp/cube4.stderr >/tmp/cube4.stdout")
Here is the standard output of the command (if any):
systemCommand("system cat /tmp/cube4.stdout")
Here is the error output of the command (if any):
systemCommand("system cat /tmp/cube4.stderr")
sh: 1: /usr/local/polymake/bin/cube: not found
Now display the contents of the file that was created:
f2: TextFile := open("/tmp/cube4.poly", "input")
>> Error detected within library code:
"File is not readable""/tmp/cube4.poly"
systemCommand("system /usr/local/polymake/bin/cross /tmp/c4.poly 4")
sh: 1: /usr/local/polymake/bin/cross: not found
systemCommand("system cat /tmp/c4.poly")
cat: /tmp/c4.poly: No such file or directory