문제

How to get the file's created, modified dates and the kind of the file using NSFileHandle? please help me out with this question. i tried with NSDate, but dint find the solution.

올바른 솔루션이 없습니다

다른 팁

NSFileHandle is not the ideal class for this. Is there some reason you want to use that class or feel you have to?

You should use -[NSURL getResourceValue:forKey:error:] with the keys NSURLCreationDateKey, NSURLContentModificationDateKey, and NSURLTypeIdentifierKey.

If you really only have an NSFileHandle to go on, you will have to obtain its file descriptor using the -fileDescriptor method and then the fstat() function to obtain the creation and modification times. You can use fcntl() with F_GETPATH to recover the path from a file descriptor. From there, you can construct an NSURL use that to get the type (and, if you prefer, the dates, too).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top