Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   Scheduling Tasks (http://www.velocityreviews.com/forums/t281864-scheduling-tasks.html)

Joe 03-05-2004 12:37 AM

Scheduling Tasks
 
I have a scheduling file that has new entries added to it at random
intervals. I wish to poll this file (say every 15 seconds) and see if there
are new entries. If there is, I then need to run another task at time in the
file entry. Could someone give me a few pointers about how to go about this?

I am programming in Windows, so would using the Task Scheduler be the best
option? I would prefer not to rely on this, because it is easily disabled,
and interfered with by the user.


TIA,
Joe.

Also, can I check whether there is better place to ask "newbie" questions? I
am teaching myself c++ as I go, and so I have lots of questions, most of
which are probably pretty basic to the people reading this group. Is this
the place to ask them? I don't want to bombard the place with irritating
questions. Should I give some indication of that they are simple questions
in the subject line?



Julie 03-05-2004 12:43 AM

Re: Scheduling Tasks
 
Joe wrote:
>
> I have a scheduling file that has new entries added to it at random
> intervals. I wish to poll this file (say every 15 seconds) and see if there
> are new entries. If there is, I then need to run another task at time in the
> file entry. Could someone give me a few pointers about how to go about this?
>
> I am programming in Windows, so would using the Task Scheduler be the best
> option? I would prefer not to rely on this, because it is easily disabled,
> and interfered with by the user.
>
> TIA,
> Joe.
>
> Also, can I check whether there is better place to ask "newbie" questions? I
> am teaching myself c++ as I go, and so I have lots of questions, most of
> which are probably pretty basic to the people reading this group. Is this
> the place to ask them? I don't want to bombard the place with irritating
> questions. Should I give some indication of that they are simple questions
> in the subject line?


http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

Chris \( Val \) 03-05-2004 11:49 AM

Re: Scheduling Tasks
 

"Joe" <anon@anon.com> wrote in message
news:BXP1c.13214$x37.9779@newsfe3-win.server.ntli.net...
| I have a scheduling file that has new entries added to it at random
| intervals. I wish to poll this file (say every 15 seconds) and see if there
| are new entries. If there is, I then need to run another task at time in the
| file entry. Could someone give me a few pointers about how to go about this?
|
| I am programming in Windows, so would using the Task Scheduler be the best

[snip]

Oop's, you posted to the wrong group :-).

Please try a Windows group - This group limits
it's discussions to the Standard C++ language
only.

Cheers.
Chris Val



Joe 03-05-2004 11:53 AM

Re: Scheduling Tasks
 

"Chris ( Val )" <chrisval@bigpond.com.au> wrote in message
news:c29pfv$1qvs2u$1@ID-110726.news.uni-berlin.de...
>
> "Joe" <anon@anon.com> wrote in message
> news:BXP1c.13214$x37.9779@newsfe3-win.server.ntli.net...
> | I have a scheduling file that has new entries added to it at random
> | intervals. I wish to poll this file (say every 15 seconds) and see if

there
> | are new entries. If there is, I then need to run another task at time in

the
> | file entry. Could someone give me a few pointers about how to go about

this?
> |
> | I am programming in Windows, so would using the Task Scheduler be the

best
>
> [snip]
>
> Oop's, you posted to the wrong group :-).
>
> Please try a Windows group - This group limits
> it's discussions to the Standard C++ language
> only.
>
> Cheers.
> Chris Val
>
>


Ok, just ignore that line. Is there a good method of doing it in standard
C++? Or is a "good" method always going to be platform dependent?

Joe.



Chris \( Val \) 03-05-2004 11:59 AM

Re: Scheduling Tasks
 

"Joe" <anon@anon.com> wrote in message
news:HRZ1c.13450$x37.5225@newsfe3-win.server.ntli.net...
|
| "Chris ( Val )" <chrisval@bigpond.com.au> wrote in message
| news:c29pfv$1qvs2u$1@ID-110726.news.uni-berlin.de...
| >
| > "Joe" <anon@anon.com> wrote in message
| > news:BXP1c.13214$x37.9779@newsfe3-win.server.ntli.net...
| > | I have a scheduling file that has new entries added to it at random
| > | intervals. I wish to poll this file (say every 15 seconds) and see if
| there
| > | are new entries. If there is, I then need to run another task at time in
| the
| > | file entry. Could someone give me a few pointers about how to go about
| this?
| > |
| > | I am programming in Windows, so would using the Task Scheduler be the
| best
| >
| > [snip]
| >
| > Oop's, you posted to the wrong group :-).
| >
| > Please try a Windows group - This group limits
| > it's discussions to the Standard C++ language
| > only.
| >
| > Cheers.
| > Chris Val
| >
| >
|
| Ok, just ignore that line. Is there a good method of doing it in standard
| C++? Or is a "good" method always going to be platform dependent?

No, unfortunately there is no built in functionality in C++
to support this kind of stuff. About the best thing you can
do, is use std::system() from <cstdlib>, to invoke the windows
task schedular. Note however, this will not be portable code -
if that is what you're looking for.

Cheers.
Chris Val



Karl Heinz Buchegger 03-05-2004 03:22 PM

Re: Scheduling Tasks
 
"Chris ( Val )" wrote:
>
> "Joe" <anon@anon.com> wrote in message
> news:HRZ1c.13450$x37.5225@newsfe3-win.server.ntli.net...
> |
> | "Chris ( Val )" <chrisval@bigpond.com.au> wrote in message
> | news:c29pfv$1qvs2u$1@ID-110726.news.uni-berlin.de...
> | >
> | > "Joe" <anon@anon.com> wrote in message
> | > news:BXP1c.13214$x37.9779@newsfe3-win.server.ntli.net...
> | > | I have a scheduling file that has new entries added to it at random
> | > | intervals. I wish to poll this file (say every 15 seconds) and see if
> | there
> | > | are new entries. If there is, I then need to run another task at time in
> | the
> | > | file entry. Could someone give me a few pointers about how to go about
> | this?
> | > |

[snip]
> | Ok, just ignore that line. Is there a good method of doing it in standard
> | C++? Or is a "good" method always going to be platform dependent?
>
> No, unfortunately there is no built in functionality in C++
> to support this kind of stuff.


Well. Actually there is a way.
You could use the time functions to poll the current time and when
15 seconds have passed: open file, read file, build up data structure
In the same loop, you check the current time and when the time specified
has reached you start the task using system().

But: It's not a good idea to do it that way :-)
So Chris is right: you need to use some system specific extensions
to fight that beast. YOu can adopt the above scheme but you will
need some sort of sleep() or delay() call to keep CPU usage low.

--
Karl Heinz Buchegger
kbuchegg@gascad.at


All times are GMT. The time now is 03:20 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.