Thread: Hiding programs ...

  1. #1
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273

    Hiding programs ...

    I have a program that I want to execute some commands every X hours, and I don't really want to really have it running 24/7, so I was wondering if anyone knows a way for a program to either run in the background and do something every once in a while or if there's a way to make a program run every X hours and then when it's finished doing what it wants to it'll finish.

    Thanks!!

    twomers

  2. #2
    60% Braindead
    Join Date
    Dec 2005
    Posts
    379
    I'm not totaly sure, but using Sleep() should make the program take alot less memory. Maybe not.

    As for the second option, there might be something in the registry that does this (doubt it) but I think you're better off using Sleep.
    Code:
    Error W8057 C:\\Life.cpp: Invalid number of arguments in function run(Brain *)

  3. #3
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Yeah, i could use Sleep(Millions of miliseconds for millions of hours) but I would prefer something which would just run it at a defined time, any ideas?

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    On a *nix box you should be able to use a cron table. On MS Windows there should be some task scheduler provided.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    Location
    Ireland
    Posts
    2,273
    Quote Originally Posted by laserlight
    On a *nix box you should be able to use a cron table. On MS Windows there should be some task scheduler provided.
    what's a *nix box?? and a cron table?

    I hadn't thought about the task scheduler!! thanks! that's a good idea!

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    what's a *nix box?
    A computer running some variant or clone of Unix, e.g. FreeBSD or Linux.

    and a cron table?
    Approximately the Unix equivalent of the Windows task scheduler.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #7
    @codeguru
    Join Date
    Jan 2006
    Posts
    34
    i hate tables. espiacly v tables

    but linux code does compile on windows right? so is there a cron table in windows?

  8. #8
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by Mitsukai
    i hate tables. espiacly v tables

    but linux code does compile on windows right? so is there a cron table in windows?
    Not all linux code compiles under windows. I haven't confirmed, but suspect that code which works with cron will not work directly under windows.

    If you look in the windows control panel, you will find a task scheduler ...... If you feel like a bit more agony, there is a command line utility dating from NT4 days called AT. Simply open a command window, and type "at /?" for more information.

  9. #9
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    What is the exact meaning of working in background? Should it's priority set to IDLE?
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Starting programs
    By Molokai in forum C Programming
    Replies: 1
    Last Post: 04-16-2009, 10:10 AM
  2. Recommend upgrade path for C programs
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-22-2007, 07:32 AM
  3. POSIX/DOS programs?
    By nickname_changed in forum C++ Programming
    Replies: 1
    Last Post: 02-28-2003, 05:42 AM
  4. Hiding programs
    By Jay_Tech in forum Windows Programming
    Replies: 4
    Last Post: 10-15-2002, 11:55 PM
  5. executing c++ programs on the web
    By gulti01 in forum C++ Programming
    Replies: 4
    Last Post: 08-12-2002, 03:12 AM