코코아를 사용하여 Mac에서 파일/폴더에 마지막으로 액세스 한 날짜를 가져올 수 있습니까?코코아에서 파일의 마지막 액세스 날짜 찾기
struct stat output;
//int ret = stat([[[openPanel filenames] lastObject] UTF8String], &output);
int ret = stat([[[openPanel filenames] lastObject] fileSystemRepresentation], &output);
// error handling omitted for this example
struct timespec accessTime = output.st_atimespec;
NSDate *aDate = [NSDate dateWithTimeIntervalSince1970:accessTime.tv_sec];
NSLog(@"Access Time %d, %@",ret, aDate);
내가 모두 UTF8String에와 fileSystemRepresentation을 시도 위의 코드 당으로
하지만, 모두가 나에게 현재 날짜를 제공하고 소 시간이 내가 뭔가 잘못을하고있는 중이 있으면 알려 주시기.
열린 패널은 선택한 각 파일의 미리보기를 표시합니까? 그렇다면 파일을 "미리보기"하는 데 필요한'read' 호출은 액세스 시간을 업데이트하는 것입니다. 'atime'은''mknod'' 또는''utimes''가 호출되었을 때,''어떤 응용 프로그램에 의해 공식적으로 열렸던 ''마지막 시간이 아닌''read '(또는'mknod', 또는'utimes') 시간이었습니다. –