is it possible to get the file creation date of files on the mac using c++? If so, may you assist me on how do I go about doing so?

Many thanks

do {		
		FSRef ref;
		if (noErr != FSPathMakeRef((const UInt8 *)filePath, &ref, NULL))
		FSCatalogInfo catalogInfo;
		if (noErr != FSGetCatalogInfo(&ref, kFSCatInfoCreateDate, &catalogInfo, NULL, NULL, NULL))
		UTCDateTime createDate = catalogInfo.createDate;
		CFAbsoluteTime absTime;
		if (noErr != UCConvertUTCDateTimeToCFAbsoluteTime (&createDate, &absTime))
		CFGregorianDate gregorianDate = CFAbsoluteTimeGetGregorianDate (absTime, NULL);
} while (false);

CFGregorianDate is a struct containing fields such as year, month, day etc.

Many thanks for your contribution. Please may you explain it. I would rather understand than simply copy and paste. Please if you do not mind.

Many thanks.

FSPathMakeRef creates a FSRef object from a given file path.
This object is passed to FSGetCatalogInfo function which returns an info about the file. kFSCatInfoCreateDate is a flag that notifies you're interested only in the creation date. You can combine different flags to obtain information about the file, which returns in catalogInfo object. Since you're interested only in the creation time, you can then access it via catalogInfo.createDate field. It's saved as UTCTime object. If you want to convert it to readable format, you first need to convert it to absolute time (using UCConvertUTCDateTimeToCFAbsoluteTime), and then to CFGregorianDate by using CFAbsoluteTimeGetGregorianDate.

BTW, developer.apple.com is an excellent source of information, you can read about all these methods there.

Useful. Thanks
This question has already been answered. Start a new discussion instead.