Thread View: pl.comp.os.linux.programowanie
2 messages
2 total messages
Started by Borneq
Wed, 18 Jan 2017 14:41
Jak pobierać czas modyfikacji pliku?
Author: Borneq
Date: Wed, 18 Jan 2017 14:41
Date: Wed, 18 Jan 2017 14:41
23 lines
1278 bytes
1278 bytes
czytam
DIR *dir;
struct dirent *ent;
if ((dir = opendir(folder)) != NULL)
{
while ((ent = readdir(dir)) != NULL)
{
if (strncmp(ent->d_name, beginName, strlen(beginName)) == 0)
{
printf("%s\n",ent->d_name);
names.push_back(ent->d_name);
}
}
closedir(dir);
}
else
{
perror("");
exit(1);
}
ale mam same nazwy, bez wielkości i bez czasu modyfikacji
Re: Jak pobierać czas modyfikacji pliku?
Author: Borneq
Date: Wed, 18 Jan 2017 15:12
Date: Wed, 18 Jan 2017 15:12
10 lines
1205 bytes
1205 bytes
W dniu 18.01.2017 o 15:41, Borneq pisze:
> printf("%s\n",ent->d_name);
struct stat st;
za pomocą stat, tylko trzeba podać całą ścieżkę
int ierr = stat((folder + "/" + string(ent->d_name)).c_str(), &st);
if (ierr != 0) {
cout << "error";
}
__time_t date = st.st_mtime;
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads