Thread: one more thing! (directory help!)

  1. #1
    Unregistered
    Guest

    one more thing! (directory help!)

    can anyone tell me how to view a randomally inputted directory?

    or how to view a directory at all......

    thanks all.

    you've been good to a very naive and green beginner!

  2. #2
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    If you are using a POSIX operating system (UNIX, Linux, etc) you would use opendir() and readdir() to get the directory information. You need to include sys/types.h and dirent.h to use these functions. Here are the function prototypes:
    Code:
    DIR *opendir(const char *name);
    struct dirent *readdir(DIR *dir);
    Pry open the dirent.h header file for the details in the dirent structure (I'm not in front of a *nix system at the moment, and my memory is failing).

    When you are finished with the directory, be sure to call closedir():
    Code:
    int closedir(DIR *dir);
    Hope that helps.
    Jason Deckard

  3. #3
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    What operating system? What do you want from the directory query? Anything specific? More information.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Finding files in a directory
    By smarta_982002 in forum C Programming
    Replies: 1
    Last Post: 01-25-2008, 10:10 AM
  2. Building a tree from a directory structure
    By geekoftheweek in forum C Programming
    Replies: 2
    Last Post: 11-26-2007, 03:15 AM
  3. Macintosh Directory Structures
    By ug52wxj in forum C Programming
    Replies: 4
    Last Post: 08-10-2003, 05:21 AM
  4. Need Help
    By GSLR in forum C Programming
    Replies: 1
    Last Post: 02-05-2002, 12:20 PM
  5. The Site Directory
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 01-22-2002, 08:19 PM