ico2
asked on
newbie ?: how do i run external .exe and com files from a c program
how do i run external .exe and com files from a c program. i also need to use switches when running these. so for instance i need to run a program like this "c:\command.com /c dir"
also how do i find out if a file or directory exists in c.
also how do i find out if a file or directory exists in c.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
when i run that i get this error:
lexical: unknown escape sequence `\c'
'("a:\command.com /c dir")'
lexical: unknown escape sequence `\c'
'("a:\command.com /c dir")'
The above example is for dos.U have findfirst() and findnext() fns. in other platforms as well.
Do this to search for files:
done = findfirst("find.txt",&ffbl k,0);
done = findfirst("find.txt",&ffbl
ASKER
thanks for the help ankuratvb. i now do not need to use command.com in my os.
U'll have to use:
system("c:\\command.com /c dir");
To avoid the escape sequence.
system("c:\\command.com /c dir");
To avoid the escape sequence.
do this:
system("c:\command.com /c dir");
U can also use the execl(when u know how many separate arguments and execv(when u have variable arguments) functions
>how do i find out if a file or directory exists in c.
Use the findfirst() function