C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 01-11-2005, 04:14 PM   #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!
Junior89 is offline   Reply With Quote
Old 01-11-2005, 04:21 PM   #2
Registered User
 
Join Date: Sep 2004
Location: California
Posts: 2,845
1) http://www.experts-exchange.com/Prog..._20409560.html

2) Depends on what OS you are using.
bithub is offline   Reply With Quote
Old 01-11-2005, 04:28 PM   #3
Carnivore ('-'v)
 
Hunter2's Avatar
 
Join Date: May 2002
Posts: 2,865
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:
Quote:
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.
Hunter2 is offline   Reply With Quote
Old 01-11-2005, 04:43 PM   #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.
Junior89 is offline   Reply With Quote
Old 01-11-2005, 04:51 PM   #5
Carnivore ('-'v)
 
Hunter2's Avatar
 
Join Date: May 2002
Posts: 2,865
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.
Hunter2 is offline   Reply With Quote
Old 01-11-2005, 04:57 PM   #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...
Junior89 is offline   Reply With Quote
Old 01-11-2005, 05:25 PM   #7
and the hat of marbles
 
Sang-drax's Avatar
 
Join Date: May 2002
Location: Göteborg, Sweden
Posts: 2,038
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
Sang-drax is offline   Reply With Quote
Old 01-11-2005, 08:42 PM   #8
Registered User
 
Codeplug's Avatar
 
Join Date: Mar 2003
Posts: 3,844
>> ... and put it in the startup folder.
Or in C:\Autoexec.bat

gg
Codeplug is online now   Reply With Quote
Old 01-11-2005, 11:00 PM   #9
Carnivore ('-'v)
 
Hunter2's Avatar
 
Join Date: May 2002
Posts: 2,865
>>gg
Codeplug wins.
__________________
Just Google It. √

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

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 08:16 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22