Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > pl.comp.os.linux.programowanie > #2085 > unrolled thread

Jak pobierać czas modyfikacji pliku?

Started byBorneq <borneq@antyspam.hidden.pl>
First post2017-01-18 15:41 +0100
Last post2017-01-18 16:12 +0100
Articles 2 — 1 participant

Back to article view | Back to pl.comp.os.linux.programowanie


Contents

  Jak pobierać czas modyfikacji pliku? Borneq <borneq@antyspam.hidden.pl> - 2017-01-18 15:41 +0100
    Re: Jak pobierać czas modyfikacji pliku? Borneq <borneq@antyspam.hidden.pl> - 2017-01-18 16:12 +0100

#2085 — Jak pobierać czas modyfikacji pliku?

FromBorneq <borneq@antyspam.hidden.pl>
Date2017-01-18 15:41 +0100
SubjectJak pobierać czas modyfikacji pliku?
Message-ID<o5nupk$p7v$1@node2.news.atman.pl>
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

[toc] | [next] | [standalone]


#2086

FromBorneq <borneq@antyspam.hidden.pl>
Date2017-01-18 16:12 +0100
Message-ID<o5o0l1$qt5$1@node2.news.atman.pl>
In reply to#2085
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;

[toc] | [prev] | [standalone]


Back to top | Article view | pl.comp.os.linux.programowanie


csiph-web