TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Classic View

Use Proportional Font
Show Text Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Date: Tue, 30 Jan 2001 09:57:09 -0500
Reply-To: Terry Westley <[log in to unmask]>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
In-Reply-To: <[log in to unmask]>
Content-Type: text/plain; charset="us-ascii"
From: Terry Westley <[log in to unmask]>
Parts/Attachments: text/plain (49 lines)
> Does anyone know if it is possible to call dos commands (i.e.
> dir, copy,
> mkdir, etc) from within
> a Ada program?

Yes, you can use TASH (http://www.adatcl.com).  This is an Ada
binding to Tcl/Tk.  The implementation of these DOS commands
is done in the Tcl C library.

Common calls such as getting directory listings, copying and
deleting files and directories and making directories are
portable to Unix and Macintosh as well as Windows.

TASH should work with any Ada 95 compiler, though my development
was done with GNAT.

With the package Tash.File, you can do all of the following.
Some, of course, don't apply to every platform, but most
will work on all three supported operating systems.

 - Get and Set File Access and Modified Times
 - Get and Set File Attributes
 - Extract File Name Portions (directory, extension, root, tail)
   from a string
 - Determine if a file exists, is executable, is readable or writable
 - Get native name
 - Get path type (absolute, relative, or volume relative)
 - Get size of a file
 - Split a file name at its path separators
 - Get File Type (File, Directory, CharacterSpecial, BlockSpecial,
   Fifo, Link, Socket)
 - Get volume names
 - Get current working directory
 - Get directory listings (using file name pattern matching)
 - Copy files and directories
 - Delete files and directories
 - Create a directory
 - Rename a file or directory
 - Join strings to form a file name with proper platform-dependent
   path separator
 - Change current working directory

For more details, download TASH and read the specification of
the package Tash.File.  Also, see http://www.adatcl.com/docs/sigada00.ppt.

--Terry Westley

       --- Visit the TASH web site at http://www.adatcl.com ---

ATOM RSS1 RSS2