Its not needed that they be in same dir. Those executables are in the System PATH. You can be in any dir and run those commands.
Its not working, can you give the code.
thanks
how about a demo??:huh:
I think you have got enough leads by now but may I ask, what is it exactly that you want to achieve? I mean I get it that you want to open certain files through your program but what is the end goal?
thats a good question!!
Before C i was using batch file for such works, but now i feel that batch file are not good, there codes and be read and modified so i want to achieve that through C
Lets C
If you’re planning to run it on a Windows platform, have you considered using wscript? Or I suppose Powershell could pull this off quite easily too.
^^no idea on wscript. can you help me?
AFAIK it’s VB code that you can run with wscript filename.vbs. It supercedes the dos batch file as it provides more interfaces to WMI, ADS. I’ve done very basic stuff with it like identifying PC name etc.
Sadly I don’t have Windows to test or help you out with this right now. But this should help.
http://www.microsoft.com/technet/scriptcenter/topics/beginner/firststeps.mspx
thanks for your help
C does not understand your files, your driver, your mouse or any other thing.
It was specifically designed to be as portable as possible.
Adding additional work of meddling with standard C is not provided as part of standard itself.
What you people are suggesting him are system/OS specific routines which is not standard C.
It is very imp that there is a difference between C and system specific functions like exec(), execve() etc.
Cu,
I forgot one thing … exec() should not work because if u call notepad program from DOS C parent program with exec() (or other variant) then will try to execute notepad in DOS env … which is not going to happen
Here Windows Scripting or Powershell scripting can help u much better
Apart from this … there are several tools available which can convert these scripts to EXE files so your code will remain hidden
Yes … C don’t understand files, drivers etc … that’s why there r library which can be integrated which can do things for us
besides … except you .c code file nothing is portable … every executable is OS dependent
reason behind suggesting exec(), system() routines is very simple … OS/system is going to handle execution … not the calling C program
You are correct, but yet incorrect. Yes, C standard (and C language) does not have any inbuilt routines to do this. But to say that this is not possible in C is blasphemy. For all that matters, first, the functions given are part of stdlib/libc with most compilers. Second, even if the functions aren’t there, one can always write the code in C to achieve the functionality. So, “not possible in C” is a semi-ignorant answer, and we know that little knowledge is a dangerous thing
routine you are again talking about are OS specific and No they do not constiture standard C.
There is a reason books are named “System Programming in C”. System here gets OS specific and thus the catch.
And no I do not take offense to any of your statements but if you think I am wrong, feel free to correct me.
^^ I agree with you that they might be OS specific. The only thing I am pointing out is that it is “possible in C”