Ecco il codice corretto per UNIX:

Codice PHP:
#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
int main()
{
  
int count;
  
DIR *d;
  if( (
opendir(".")) != NULL)
  {
    for(
count 0;  readdir(d) != NULLcount++);
    
closedir(d);
   }
   
printf("\n %d"count);
   return 
0;