Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could try using the <a href="http://www.boost.org/doc/libs/1_38_0/libs/filesystem/doc/index.htm" rel="nofollow noreferrer">Boost</a> library, which seems to be a popular choice. It runs on <a href="http://www.danielsefton.com/2012/03/building-boost-1-49-with-clang-ios-5-1-and-xcode-4-3/" rel="nofollow noreferrer">iOS</a> and <a href="http://www.mfoot.com/2011/12/building-boost-1-47-for-android-using-cmake-and-the-ndk/" rel="nofollow noreferrer">Android</a>.</p> <p>See <a href="https://stackoverflow.com/a/612112/1448759">this answer</a> on SO for more info on how to use Boost to manipulate files and directories in a cross platform way.</p> <p>For example, here's some code from the Boost website to check if a particular file exists or not, checking recursively in a directory:</p> <pre><code>#include "boost/filesystem/operations.hpp" #include "boost/filesystem/path.hpp" #include "boost/progress.hpp" #include &lt;iostream&gt; namespace fs = boost::filesystem; int main( int argc, char* argv[] ) { boost::progress_timer t( std::clog ); fs::path full_path( fs::initial_path&lt;fs::path&gt;() ); if ( argc &gt; 1 ) full_path = fs::system_complete( fs::path( argv[1] ) ); else std::cout &lt;&lt; "\nusage: simple_ls [path]" &lt;&lt; std::endl; unsigned long file_count = 0; unsigned long dir_count = 0; unsigned long other_count = 0; unsigned long err_count = 0; if ( !fs::exists( full_path ) ) { std::cout &lt;&lt; "\nNot found: " &lt;&lt; full_path.file_string() &lt;&lt; std::endl; return 1; } if ( fs::is_directory( full_path ) ) { std::cout &lt;&lt; "\nIn directory: " &lt;&lt; full_path.directory_string() &lt;&lt; "\n\n"; fs::directory_iterator end_iter; for ( fs::directory_iterator dir_itr( full_path ); dir_itr != end_iter; ++dir_itr ) { try { if ( fs::is_directory( dir_itr-&gt;status() ) ) { ++dir_count; std::cout &lt;&lt; dir_itr-&gt;path().filename() &lt;&lt; " [directory]\n"; } else if ( fs::is_regular_file( dir_itr-&gt;status() ) ) { ++file_count; std::cout &lt;&lt; dir_itr-&gt;path().filename() &lt;&lt; "\n"; } else { ++other_count; std::cout &lt;&lt; dir_itr-&gt;path().filename() &lt;&lt; " [other]\n"; } } catch ( const std::exception &amp; ex ) { ++err_count; std::cout &lt;&lt; dir_itr-&gt;path().filename() &lt;&lt; " " &lt;&lt; ex.what() &lt;&lt; std::endl; } } std::cout &lt;&lt; "\n" &lt;&lt; file_count &lt;&lt; " files\n" &lt;&lt; dir_count &lt;&lt; " directories\n" &lt;&lt; other_count &lt;&lt; " others\n" &lt;&lt; err_count &lt;&lt; " errors\n"; } else // must be a file { std::cout &lt;&lt; "\nFound: " &lt;&lt; full_path.file_string() &lt;&lt; "\n"; } return 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload