Seite 1 von 2

opendir

Verfasst: So Feb 24, 2013 8:56 pm
von naums
Ahoi,

Auf andren Webseiten hab ich ne Funktion opendir, readdir und closedir gefunden. Wie verwende ich die, wo finde ich ggf. weitere Informationen. Weder auf Proggen noch in der Cplusplus.com-Referenz finde ich dazu etwas.

MfG

Re: opendir

Verfasst: So Feb 24, 2013 9:01 pm
von fat-lobyte
Welches OS / welche Desktopumgebung hast du?

Re: opendir

Verfasst: So Feb 24, 2013 9:03 pm
von naums
ICH habe derzeit Xubuntu (Linux, XFCE).

Das Programm muss unter Windows 7 und XP, Apple Mac OSX und Linux laufen.

Re: opendir

Verfasst: So Feb 24, 2013 9:06 pm
von Xin

Code: Alles auswählen

#include <sys/types.h>
#include <dirent.h>

int main(int argc, char **argv)
{
  DIR *dir;
  struct dirent * entry;
  dir = opendir(".");

  if (dir) 
  {
    while(( entry = readdir(dir) )) 
      printf( "Entry: %s\n", entry->d_name);

    closedir(dir);
  }
}

Re: opendir

Verfasst: So Feb 24, 2013 9:14 pm
von naums
gehört das irgendwie zu irgendnem C/C++ Standard?

Re: opendir

Verfasst: So Feb 24, 2013 9:24 pm
von fat-lobyte
tipp mal folgendes in die Konsole ein:

Code: Alles auswählen

sudo apt-get install manpages-dev
man 3 opendir
Das gehört zum POSIX-Standard. Steht übrigens auch ganz unten in der Manpage.

Re: opendir

Verfasst: So Feb 24, 2013 10:39 pm
von naums
POSIX? Also unterstützt das Windows wieder nich?

Re: opendir

Verfasst: So Feb 24, 2013 10:42 pm
von fat-lobyte
Richtig. Es gibt aber ganz sicher ein Äquivalent dazu.

Re: opendir

Verfasst: So Feb 24, 2013 11:27 pm
von naums
damit für mich uninteressant, danke.

Re: opendir

Verfasst: Mo Feb 25, 2013 12:09 pm
von Xin
naums hat geschrieben:damit für mich uninteressant, danke.
Du kannst Dir eine Klasse als Wrapper drumrumpacken!?