#include <ctime>
#include <cstdio>
#include <sys/types.h>
#include <iostream>
#include <sys/stat.h>
#include <windows.h>
using namespace std;
int main()
{
char file[] = "E:\\user\\plik.txt";
char file2[] = "E:\\user\\plik2.txt";
char t[ 100 ] = "";
char q[ 100 ] = "";
struct stat b;
struct stat c;
if( !stat( file, & b ) )
{
strftime( t, 100, "%d/%m/%Y %H:%M:%S", localtime( & b.st_mtime ) );
printf( "\nData ostatniej modyfikacji = %s\n", t );
}
if( !stat( file2, & c ) )
{
strftime( q, 100, "%d/%m/%Y %H:%M:%S", localtime( & c.st_mtime ) );
printf( "\nData ostatniej modyfikacji = %s\n", q );
}
if( t < q )
{
printf("1 plik jest wiekszy\n");
system("E://user//kot.png");
}
getchar();
return 0;
}
Mam problem z porownaniem 2 dat pobranych za pomoca funkcji "st_mtime". Nie mam pomysłu jak mozna je ze soba porownac.
Nastepnym problemem, a w zasadzie pytaniem jest; Jezeli za pomoca "system" otwieram jakis plik, to jaką funkcją moge go zamknąć ?