Created
March 2, 2014 11:01
-
-
Save zwetan/9304943 to your computer and use it in GitHub Desktop.
listing directories with redtamarin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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