Re: Finding particular files in the given directory path !



/* I'm sure you can come up with something better than "strstr()"
   (I guess theres some "glib" way but this will work ;P )
*/

DIR *dir;
struct dirent *entry;

if ((dir = opendir(const char *path) != NULL) {

  while ((entry = readdir(dir)) {
    if (strstr(entry->d_name, ".pdf")) {
        /* add to a list or something ;) */
    }
        
  }
}


Cheers
        -Tristan
--------------------
Anita Dixit wrote:

Hi ,

I am using Gtk+ 1.2.9
If I have a certain directory path and have to find some files say I
have to search all the .pdf files available in that directory .
How to go about it  ?

Thanks and Regards,

-Anita

*********************************************************
Disclaimer

This message (including any attachments) contains
confidential information intended for a specific
individual and purpose, and is protected by law.
If you are not the intended recipient, you should
delete this message and are hereby notified that
any disclosure, copying, or distribution of this
message, or the taking of any action based on it,
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]