Getting back to the top of the directory

This is a discussion on Getting back to the top of the directory within the Linux Programming forums, part of the Platform Specific Boards category; When I use the readdir command to read directory entries into my program, what do I do when I've read ...

  1. #1
    Budding Synth Programmer samGwilliam's Avatar
    Join Date
    Feb 2002
    Location
    Trefforest
    Posts
    368

    Getting back to the top of the directory

    When I use the readdir command to read directory entries into my program, what do I do when I've read the last directory and readdir () returns NULL? What I want to do is return to the top of the directory so the readdir () calls will start returning directory entries from the directory again. How can this be done?

  2. #2
    Registered User alex's Avatar
    Join Date
    Sep 2001
    Posts
    132
    rewinddir(dir);

    alex

  3. #3
    Budding Synth Programmer samGwilliam's Avatar
    Join Date
    Feb 2002
    Location
    Trefforest
    Posts
    368
    Thank you very much!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Couple errors please help :-D
    By JJJIrish05 in forum C Programming
    Replies: 9
    Last Post: 03-06-2008, 01:54 AM
  2. how to make opengl draw in lighter colors ?
    By jabka in forum Game Programming
    Replies: 2
    Last Post: 12-17-2007, 05:12 AM
  3. Directory crawler problems
    By mart_man00 in forum C Programming
    Replies: 31
    Last Post: 08-17-2003, 09:33 PM
  4. phone book directory 2
    By arangawawa in forum C Programming
    Replies: 4
    Last Post: 08-01-2003, 05:32 PM
  5. Replies: 6
    Last Post: 07-30-2003, 03:08 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21