NDK 如何获取文件的修改日期?

How does NDK get modified date of a file?

我是 Android NDK 的新手。这是一个获取按修改日期排序的文件列表的函数。我找遍了这个论坛,没有运气。

任何人都可以给我提示吗?

谢谢

这应该是c++特有的问题,请尝试使用:

struct stat attrib;
stat(filePath, &attrib);
char date[10];
strftime(date, 20, "%d-%m-%y", localtime(&(attrib.st_ctime))); 
printf("The file %s was last modified at %s\n", filePath, date);

Found Here

那么您只需按 &(attrib.st_ctime)

对您的文件列表进行排序

EDIT for second question:

使用 std::sort 并告诉它使用自定义比较对象,例如 here