finding differnce in minutes from two dates from ini file and sysdate



Hi folks. I inherited an FTP program from a colleague that left the team so i have to do C++ programming now. The problem is that the FTP program throws up winsock errors. the FTP skips these errors but after a while it terminates the program. So I writing another prgram that monitors the FTP process. When it starts the Send/Receive process i write to an inifile the date and process=1 and at end of process i write date and process=0. in the monitor program i read the inifile the process and date, if process = 1 and date <10 minutes old the forcibly temainate the FTP program, if process = 0 then terminate every 30 minutes.

The problem i have is that i cant seem to get the time difference in minutes when i read from the inifile, ie diff.
the other problem i have is that i donot know the commands ion C++ to terminate and start the exe of the FTP program

I am a total newbie to C++ so any assistance you'll can provide is greatly appreciated. Here is the code of the part where i calculate the time difference. :

TIniFile* IniFileB;
IniFileB =new TIniFile ("C:\\GCOS\\FTP\\EXE\\ftpbusy.ini" );

double startdate;
int Process;
long diff;
long end;
diff = 0;
String sRightVal;

Process = IniFileB->ReadInteger("Main","Process",10);
startdate = IniFileB->ReadDateTime("Date","DT", Now());

diff = difftime(startdate,time);
delete IniFileB ;
Last edited on
Topic archived. No new replies allowed.