> 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
- 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.
--- Visit the TASH web site at http://www.adatcl.com ---