topical media & game development

talk show tell print

lib-of-vs-addons-ofxDirList-doc-Instructions.txt / txt



  ofDirList - July 18th 2007 - by Theodore Watson
  
  Installation:
  1 Copy ofDirList.h and ofDirList.cpp to your ofAddons folder.
  2 Add #include <ofDirList.h> to ofAddons.h
  3 Add ofDirList.h and ofDirList.cpp to IDE
  
  Changes:
  1 Now takes string type as argument
  2 Fixed wildcard * for allowing all extensions
  3 Extensions are now case insensitive
  4 reset() function to clear extension list
  
  Example Usage:
  
  
//////////////////////////////////////////

ofDirList DIR; //Allow only certain files //by specifying extension //Extensions are not case sensitive //so 'mov' allows both 'mov' and 'MOV' //To include all files either don't //call allowExt or specify the wildcard // '*' DIR.allowExt("mov"); DIR.allowExt("jpg"); //if you wish to keep the console quiet DIR.setVerbose(false); //now lets list the directory //listDir returns number of files found //with the specified extension int numFiles = DIR.listDir("images/"); //you can now iterate through the files as you like for(int i = 0; i < numFiles; i++){ printf("name is \%s - path is \%s \n", DIR.getName(i), DIR.getPath(i) ); } //if you want to reuse ofDirList for different files //call reset(); to clear the allowed extensions


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.