Skip to content

Instantly share code, notes, and snippets.

@zwetan
Created March 2, 2014 11:01
Show Gist options
  • Save zwetan/9304943 to your computer and use it in GitHub Desktop.
Save zwetan/9304943 to your computer and use it in GitHub Desktop.
listing directories with redtamarin
import C.errno.*;
import C.dirent.*;
trace( "----" );
var dirp:DIR = opendir( "." );
if( !dirp )
{
trace( "Could not open directory \".\"" );
}
//read the first entry
/*var dp:dirent = readdir( dirp );
if( !dp )
{
trace( "Could not read directory entry" );
}
else
{
trace( "directory entry:" );
trace( "d_ino = " + dp.d_ino );
trace( "d_name = " + dp.d_name );
}*/
//read all entries
var dp:dirent;
while( dp = readdir( dirp ) )
{
trace( dp.d_name );
}
var result:int = closedir( dirp );
if( result < 0 )
{
trace( "Error: " + errno );
}
trace( "----" );
trace( "bye bye program" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment