title: Functionality of Alphasort
body: <p>I'm using the scandir() function for one of my C programs. Within scandir(), I ask it to alphasort my directory. Yet, when I have files such as: alpha,bob, they're placed under files like DARK or Decomp.txt. I assume this is because of how the ascii values work. But is there are way so that my ordering would be: alpha,bob,DARK,decomp.txt rather than DARK,Decomp.txt,alpha,bob. </p>
  
  <p>Because essentially I am supposed to model the tree unix command and need it to be sorted in such a manner. </p>
  
  <p>My code below only shows how i'm printing.</p>
  
  <pre><code>void listdir(const char *name, int level, int hidden, int access)
  {
  DIR *dir;
  struct dirent **entry;
  int n = 2;
  int num;
  char path[1024];
  int len;
  int count = 0;
  if (!(dir = opendir(name)))
  {
      printf("%s [error opening dir]\n", name);
      return;
  }
  num = scandir(name,&amp;entry,NULL,alphasort);
  if(num&lt;0)
  {
      perror("scandir");
  }
  while(n&lt;num){
      /* Bunch of formatting to print files/directory */
      /* Pseudocode */
      /* if( it is a directory)
         print current directory
         recursive call on function
  
         else
         print current file */
      n++;
  }
  
  closedir(dir);
  </code></pre>
  
  <p>}</p>