I want to make a program that displays the time every 2 min in a txt file but idk how to do it.I wrote this but it doesn't do the desired effect it only writes the time once.
if your on linux: just cron it. if your on windows: i have a console hide function i think ( i cant remember if i got rid of it) and you can just have it continuosly run in the background and have it write to file every 2 mins
since your code will exit after you write it.
several problems,
1. the Sleep is in milliseconds, 1 second = 1000 milliseconds, so Sleep(2000)
2. write two calls of Time() function cannot help to run it forever, you can try
while(true)
{
Time();
Sleep(2000);
}
instead
3. you can also try to use for in windows cmd, for /L %i in (0,0,1) do (your_app.exe)