| | |
Need help making a program
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
Sorry, I didn't get you, but can you please clarify more, give me example of your problem
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
you should have a method take a string as a parameter and execute it as command like
void Execute(char* command)
{
system (command)
}
and infinite loop in another thread let me write the pesudo code for it
for( ; ; )
call Execute stop this thread for 10 seconds
void Execute(char* command)
{
system (command)
}
and infinite loop in another thread let me write the pesudo code for it
for( ; ; )
call Execute stop this thread for 10 seconds
Last edited by Ramy Mahrous; Sep 16th, 2007 at 2:45 am.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Well since you seem to be using windows, there are already a couple of ways built in to do this.
1. Use the 'at' command
2. From the control panel, choose "Scheduled Tasks" then "Add Scheduled Task" and follow the prompts.
1. Use the 'at' command
C++ Syntax (Toggle Plain Text)
$ at /? The AT command schedules commands and programs to run on a computer at a specified time and date. The Schedule service must be running to use the AT command. AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]] AT [\\computername] time [/INTERACTIVE] [ /EVERY:date[,...] | /NEXT:date[,...]] "command" \\computername Specifies a remote computer. Commands are scheduled on the local computer if this parameter is omitted. id Is an identification number assigned to a scheduled command. /delete Cancels a scheduled command. If id is omitted, all the scheduled commands on the computer are canceled. /yes Used with cancel all jobs command when no further confirmation is desired. time Specifies the time when command is to run. /interactive Allows the job to interact with the desktop of the user who is logged on at the time the job runs. /every:date[,...] Runs the command on each specified day(s) of the week or month. If date is omitted, the current day of the month is assumed. /next:date[,...] Runs the specified command on the next occurrence of the day (for example, next Thursday). If date is omitted, the current day of the month is assumed. "command" Is the Windows NT command, or batch program to be run.
2. From the control panel, choose "Scheduled Tasks" then "Add Scheduled Task" and follow the prompts.
•
•
Join Date: Sep 2007
Posts: 7
Reputation:
Solved Threads: 0
hmm... but what i mean is in the command prompt i tpye in C:/programfiles/blahblahblah so i hit enter. it opens the .exe. So when i hit the arrow up botton it has the same cmd in it.. so what i wanna do is have that arrow go up and exeute it every 90 seconds... so how would i do that?
thanks alot like i said i am new to the whole programing stuff.. I am a 3d arist but this is somthing i wanted to pick up for along time.. thanks.
thanks alot like i said i am new to the whole programing stuff.. I am a 3d arist but this is somthing i wanted to pick up for along time.. thanks.
C++ Syntax (Toggle Plain Text)
while(true) { system("<yourcommand here>"); Sleep(90000);//have to include windows.h I think }
"Hey ass, don't hijack my thread. This is serious." -JoshSCH
•
•
•
•
hmm... but what i mean is in the command prompt i tpye in C:/programfiles/blahblahblah so i hit enter. it opens the .exe. So when i hit the arrow up botton it has the same cmd in it.. so what i wanna do is have that arrow go up and exeute it every 90 seconds... so how would i do that?
.
The other alternative is to execute the program from the cmd prompt just once and have it do its stuff repeadetly forever -- using loops, something like this: [edit]which is nearly the same as Sturm posted[/edit]
C++ Syntax (Toggle Plain Text)
#include <windows.h> int main() { for(;;) { // execute some code here, not shown do_something(); // wait one second Sleep(1000); } return 0; }
Last edited by Ancient Dragon; Sep 16th, 2007 at 7:50 pm.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Similar Threads
- Remote Access/VNC-like Program? (Visual Basic 4 / 5 / 6)
- Program running in the background and in the tray (C#)
- Making a program run when send to someone else? (C++)
- Want help making program access a web page automatic. (C)
- I need help making a program (C)
- Making a program that will display the result of a coin (C++)
- Please help me out with this C++ program (C++)
- Im lost in my program, plesae please help (C)
Other Threads in the C++ Forum
- Previous Thread: Print
- Next Thread: problem implementing BFS using string vector
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator getline givemetehcodez graph iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






