tags:

views:

71

answers:

2

Hello.

I`m really new with objective-c and mac osx programming.

I write simple GUI application with button and label. When i press button, label change it text to another text. Now i want to understand how to get file attributes. I have read a lot of topics but can not find simple example.

What i need, it is a simple example: window with label and button, when i press button, label should change it text to file creation or last modify date. File path will be hardcoded, e.g. /Users/MYUSER/Downloads/text.txt

Please help me or point me to good article or something like this.

A: 

You might want to look at Rosetta Code for an example of getting a file's modification time.

slhck
Thank you! Exactly what i need
Alex Molskiy
A: 

Example from Rosetta Code has deprecated parts. Here is the right code for getting file modification date

NSString *path = @"/Users/Raven/Downloads/1.png";
    NSDictionary* fileAttribs = [[NSFileManager defaultManager] attributesOfItemAtPath:path error:nil];
    NSString *result = [fileAttribs valueForKey:NSFileModificationDate];
    NSLog(@"%@",result);
Alex Molskiy