execl()'ing batch files in DOS
Blair P. Houghton
bph at buengc.BU.EDU
Thu May 18 04:28:09 AEST 1989
In article <302 at ohs.UUCP> mday at ohs.UUCP (Matthew T. Day) writes:
>Does anybody know if it's possible to execl() a batch file in DOS? I am
>using MicroSoft C v5.1, and using MS-DOS v3.30. I have tried:
>
> execl("\command.com", "tryit.bat", NULL);
>
>and perror() tells me "No such file or directory." Any help or input would
>be appreciated.
Perhaps the backslash is causing the following c to be interpreted literally
as a c, i.e., as though the backslash weren't there at all.
I.e. it's actually doing the same as
execl("command.com", "tryit.bat", NULL);
which looks in the current dir, not in the root dir, for command.com.
replace the single backslash with a double backslash, and the first will
cause the second to be interpreted literally _by_the_compiler_...
execl("\\command.com", "tryit.bat", NULL);
now the string itself will contain the backslash.
--Blair
"Good thing it wasn't a trigraph.
We might have stepped in it..."
More information about the Comp.lang.c
mailing list