home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!usenet-feed.umr.edu!mcastle
- From: mcastle@cs.umr.edu (Michael R Castle)
- Subject: Re: Help with spawnl() function
- References: <yT7JXB3w164w@jaflrn.UUCP> <TskPXB3w165w@wozzle.linet.org>
- Date: Sat, 23 Jan 1993 01:40:06 GMT
- Nntp-Posting-Host: next8.cs.umr.edu
- Organization: University of Missouri - Rolla, Rolla, MO
- Sender: cnews@umr.edu (UMR Usenet News Post)
- Message-ID: <1993Jan23.014006.2642@umr.edu>
- Lines: 43
-
- In article <TskPXB3w165w@wozzle.linet.org> alane@wozzle.linet.org (J. Alan Eldridge) writes:
- >jaf@jaflrn.UUCP (Jon Freivald) writes:
- >
- >> Why not use remove() or unlink()? You can't do "system("del file")
- >> because del (& erase) are internal commands, although you could do
- >> "system("command /c del file")" [a consideration here - what about folks
- >> who don't use command.com? It's no-where on my machine, and which
- >> command processor I'm using depends on what mood I'm in..!]
- >
- >char szCmdbuf[ 130 ];
- >char *szComspec=getenv("COMSPEC");
- >
- >if (!szComspec)
- > szComspec="COMMAND.COM";
- >sprintf(szCmdbuf, "%s /C del file", szComspec);
- >system(szCmdbuf);
-
- From my turbo-c++ 1.00 manual:
-
- _system_ invokes the DOS COMMAND.COM file to execute a DOS command, batch
- file, or other program named by the string command, from inside an executing
- C program.
-
- To be located and executed, the program must be in the current directory
- or in one of the directories listed in the PATH string in the environment.
-
- The COMSPEC envrionment variable is used to find the COMMAND.COM file, so
- that file need not be in the current directory.
-
- Copyright 1990 by Borland International. Reprinted without permission.
-
- Now, if borland did it right, it will use whatever is in COMSPEC, be it
- 4dos, ndos, or whatever. The problem will then be, does your shell
- support that command internally? If not, is there an executable or
- batch file that does?
-
- regards,
- mrc
- --
- Mike Castle .-=NEXUS=-. Life is like a clock: You can work constantly
- mcastle@cs.umr.edu and be right all the time, or not work at all
- S087891@UMRVMA.UMR.EDU and be right at least twice a day. -- mrc
- We are all of us living in the shadow of Manhattan. -- Watchmen
-