system() has nothing to do there (it's even prohibited under Windows...)
Just use the scheduler
You are definitely right. But i gotta justify my reply.
The poster wanted to ask if he can call exes at given time.
For this the he can write a code to call his exes.
The scheduler does schedule execution of the exes. But what i replied was related to 'through code' .
system() call is very much 'allowed' in Windows(If u meant that the system() call in Win environment is not allowed).
I use Dev-C++ on Win Xp and use the system("PAUSE") call to pause the program just before it passes control to the OS.
i am ranjith intrested in writing c c++ progs i hav a doubt that can i write a c or c++ program to excute at a given time
You're going to have to clarify. Do you have some executable program, originally written in C++, that you want to run at, say 2 p.m.? All sorts of languages can be used to cause this to happen, not just C++, and you don't need to write your own. As mentioned, the Operating System can handle this for you with no code written by you (i.e. the scheduler, as mentioned). Or are you trying to write a program in C++ that will run an executable program at a specified time (i.e. are you WRITING a scheduler program in C++)?
#include <iostream> // For Simple Input & Output.
#include <time.h> // For dealing with time.
#include <conio.h> // For getch() function.
using namespace std;
struct tm T;
_getsystime( &T );
if (T.tm_hour == 12) // If the Time is 12 PM.
cout << "Sorry this programme can't be executed at this time";
//Your Programme Here
I think it should work with you ,Because i tryed it before posting and it worked well...