salam
i need help for an assignment in which there is a value stored in a variable which is decreasing with the passage of time. if there is a shut down in system (either normal or abnormal), the current value remains same on next login.
kindly guide me where to start, as i m new in linux but dont send me complete coding. i know little programming in C (windows) just tell me where to start in linux.
thanks
where to start programming....
-
- Major General
- Posts: 917
- Joined: Thu Jun 27, 2002 5:45 pm
- Location: Karachi
- Contact:
Re: where to start programming....
Dear sherwani,sherwani wrote:salam
i need help for an assignment in which there is a value stored in a variable which is decreasing with the passage of time. if there is a shut down in system (either normal or abnormal), the current value remains same on next login.
kindly guide me where to start, as i m new in linux but dont send me complete coding. i know little programming in C (windows) just tell me where to start in linux.
thanks
its best if you will use bash scripting and GCC (Gnu compiler collection), Daily play 5 to 6 hours on these things than you can understand what u want to do.
Regards
Noman Liaquat Khanzada Rajput
Money is not everything
Re: where to start programming....
you can run a program that stores the value in a file, and decreases its value over the passage of time, but you can't do it with an environment variable in a useful way.sherwani wrote:i need help for an assignment in which there is a value stored in a variable which is decreasing with the passage of time. if there is a shut down in system (either normal or abnormal), the current value remains same on next login.
please explain why you want to do this so we can find a better solution for you.
Dear sherwani,
its better to save your value in current running system and then then don't delete those files, lets power off ur system due to electricity, then u read the file
tmp=`cat /var/xyzvlue`
and then use it where you want to , its better to do bash scripting.
Regards
Noman Liaquat Khanzada Rajput
Money is not everything
"Microsoft isn't evil, they just make really crappy operating systems." - Linus Torvalds
its better to save your value in current running system and then then don't delete those files, lets power off ur system due to electricity, then u read the file
tmp=`cat /var/xyzvlue`
and then use it where you want to , its better to do bash scripting.
Regards
Noman Liaquat Khanzada Rajput
Money is not everything
"Microsoft isn't evil, they just make really crappy operating systems." - Linus Torvalds
Re: where to start programming....
man gcc as farhantoqeer said. And then you can sleepsherwani wrote:salam
i need help for an assignment in which there is a value stored in a variable which is decreasing with the passage of time. if there is a shut down in system (either normal or abnormal), the current value remains same on next login.
kindly guide me where to start, as i m new in linux but dont send me complete coding. i know little programming in C (windows) just tell me where to start in linux.
thanks
Code: Select all
#include <time.h>
void sleep(unsigned int millisec)
{
clock_t goal = millisec + clock();
while (goal > clock());
}
//Now update value (in file or whatever) each time you call sleep() in loop
Ali