View Single Post
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-19-2009 , 18:45   open_dir() + next_file() +? alphabetical.
Reply With Quote #1

I'm trying to read files in alphabetically but when I use this the files are not alphabetical.

PHP Code:
    new filename[32], len
    
    
new pDir open_dir(szFilepathfilenamecharsmax(filename))
    
    if(
pDir)
    {
        do
        {
            
len strlen(filename)

            if(
len 4)
            {
                if( 
equal(filename[len 4], ".ini") )
                {
                    
// Load file!!!
                    
server_print("Filename: %s"filename)
                    
// server_print(">>>>Yippeeeee!!!!!!!")
                
}
            }
        } while( 
next_file(pDirfilenamecharsmax(filename)) )
        
close_dir(pDir)
    } 
Output:
Code:
test
Filename: maps2.ini
Filename: maps3.ini
Filename: maps4.ini
Filename: maps1.ini
The ultimate goal is to be able to define the order files are read by prefixing the filenames with 1, 2, 3, etc. Like rc#.d folders in linux (I'm using Fedora).
__________________
fysiks is offline