Advertisement

FindFirstFile&FindNextFile equivalent?

Started by February 15, 2002 08:02 AM
4 comments, last by cody 22 years, 7 months ago
hi, im porting a game from windows to linux and i need to exchange the FindFirstFile and FindNextFile win32 functions. i need to know the linux equivalents. cody
readdir() and family (opendir, readdir, telldir, closedir, rewinddir, dirfd). On Linux and BSD, there is also scandir() and alphasort(). I don''t remember if there is a SysV equivalent, but there ought to be.
Advertisement
yeah, i found these functions, however im wondering how i know if a value returned by readdir() is a directory or a file.
  struct stat info;struct dirent *ent;/* Fill ent from readdir */stat(ent->d_name, &info);if(info.st_mode & S_IFDIR)  printf("It''s a directory.\n");  

Look in the man pages for more information on stat.

thx!

the problem is that i cant use my linux right now because i dont know where the cable of the linux-harddisk is. :-)
The man page for ''stat'' (and about everything else related to Unix) can be found at www.freebsd.org, under "documentation->more...". That way you''re not stuck until you find that cable.

And of course, google is your friend.

This topic is closed to new replies.

Advertisement