C/C++の宿題片付けます 128代目
at TECH
902:デフォルトの名無しさん
09/07/10 23:51:59
>>827
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#define SLEEP_TIME 1
int main(int argc, char *argv[])
{
struct stat file;
time_t prev_mtime;
if (argc != 2) {
printf("Usage: exp7 file1 file2\n");
exit(1);
}
if (stat(argv[1], &file) != 0) {
printf("%s not found\n", argv[1]);
exit(1);
}
prev_mtime = file.st_mtime;
while (1) {
stat(argv[1], &file);
if (file.st_mtime != prev_mtime) {
printf("\nModified %s %s", argv[1],
asctime(localtime(&file.st_mtime)));
prev_mtime = file.st_mtime;
}
sleep(SLEEP_TIME);
}
}
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5080日前に更新/375 KB
担当:undef