please help me, how to delete a file every second?

 

hi friends, i'm trying to delete a file on /file every second. I'm familiar with ontick function, but this time i need it to work every second, or even less, so how can i code this?


a- its using ontimer function?


void OnTimer()
{

EventSetTimer (); // How to use this to delete file "b" every second? If there is another way to do this please show me how

FileDelete ("b",0);

     
}

b- If its not on ontimer function, how can i do this?


thanks for any help

 
EventSetTimer(1);

Is usually placed in OnInit() Function.

Then the code in OnTimer() {} will run once every second.
 
Marco vd Heijden:

Is usually placed in OnInit() Function.

Then the code in OnTimer() {} will run once every second.

Great, now it's working, thanks a lot

 

If you need something faster you can also try

EventSetMillisecondTimer(500); //0.5 sec

But if you go too low then it can start to consume too much resources.

Also in extreme cases with fast read and write cycles, you can 'burn' a hole in your SSD solid state drive so use with caution they have a limited amount of read and write cycles.

 
Marco vd Heijden:

If you need something faster you can also try

But if you go too low then it can start to consume too much resources.

Also in extreme cases with fast read and write cycles, you can 'burn' a hole in your SSD solid state drive so use with caution they have a limited amount of read and write cycles.


good to know, that's one of the reasons why i don't like ssd's

Reason: