Thread: Computer Startup Log Program

  1. #1
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434

    Computer Startup Log Program

    Hi guys i want to write a program that runs when the computer is turned on and records what time the computer was turned on into a txt file. I know how to do the file input/output stuff but i need to know:

    1) how to get the date & time with <time.h>
    2) how to get the program to run when the computer starts

    Thanks alot guys!

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    1) http://www.experts-exchange.com/Prog..._20409560.html

    2) Depends on what OS you are using.

  3. #3
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    2) Assuming you're on Windows XP, one solution is to create a shortcut to your program under Start Menu->Programs->Startup. That works on Windows Classic view, not sure if the folder is the same in the default style. Alternately, you can add a registry value to:
    HKEY_CURRENT_USER\Software\Microsoft\Windows\Curre ntVersion\Run
    Name the value anything you want, and set the value data to the path of your program.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  4. #4
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    Im using Windows Me, and remember im a novice so the easiest way would be appreciated. Thanks.

  5. #5
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Then, the shortcut should work I believe. I'm not sure exactly where the start menu folder is located, but I think you can right-click on the start menu and there will be an option called 'explore'. Then you can browse to Programs\Startup, and create the shortcut there. Otherwise, just do a search on your computer for 'startup' and find the one that has a path involving 'start menu'.

    Otherwise, I'm pretty sure the registry option will work as well.. but if you're not comfortable mucking around with that, then just go with the shortcut.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  6. #6
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    Thanks Hunter2 that's one problem solved but now the question of time/date still remains...

  7. #7
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    If you don't want to write your own program, one solution is a command like this:
    Code:
    time < nul >> time.txt
    This will append the current time to the file time.txt.

    Put this single line in a .bat file and put it in the startup folder.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  8. #8
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    >> ... and put it in the startup folder.
    Or in C:\Autoexec.bat

    gg

  9. #9
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    >>gg
    Codeplug wins.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need some help with a program
    By calsonicgtr in forum C++ Programming
    Replies: 4
    Last Post: 09-18-2008, 08:47 PM
  2. C program to copy log file frm database
    By nirmala.s in forum C Programming
    Replies: 15
    Last Post: 11-27-2006, 11:05 AM
  3. need help on C++ program
    By tezr87 in forum C++ Programming
    Replies: 1
    Last Post: 06-01-2006, 04:40 AM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM