FutureBasic Logo

<<    Index    >> FutureBasic 5

open "UNIX"   statement



Syntax:
open "UNIX",fileID,UNIXcommand$
Revised:
August, 2002 (Release 7)

Description:
Mac MacOS X brings a wealth of commands with its UNIX foundation. These commands are easy to access from FutureBasic. You may establish one or several simultaneous channels by opening them as files. Each channel should have a unique file number. There is a theoretical maximum of 255 files or channels that may be opened at once.
Once the channel has been opened, you read from the file to accept the resulting list from UNIX. (Exception: some UNIX commands perform a task without responding to the user, so no file reading is required.) When the operation is complete, close the channel as you would any file; with the close statement.
There are literally hundreds of books written about UNIX commands. Suffice it to say that if the Mac supports a specific UNIX command, it may be accessed through open "UNIX"

Example:
dim as Str255 a
window 1,, (0,0)-(600,550)
text _monaco, 10
// print a title-string then list a directory
open "UNIX", 2, "echo ""Root Directory""; ls -l"
do
   line input #2, A
   print a
until eof(2)
close 2
do
   HandleEvents
until 0


Note:
open "UNIX" works only in MacOS X.

See Also:
line input; close