I need to print the names of all files in the current directory. 
but I must do it only with system calls, so I have the `SYS_OPEN, SYS_GETDENTS, SYS_READ` etc. I'm working on Ubuntu.
How can I do it?
I tried to use this:

```
system_call(SYS_OPEN, ".", 0, 0777);

```

and then to `READ` from and write to `STDOUT`.. but it's not working.

\*\* I cannot use the standard library.
Thank you! 

EDIT:
an example code:
\*\* there is a file in assembly, with the function "system call" that do the call.
 #include "util.h"

```
#define SYS_WRITE 4

#define SYS_OPEN 5

#define SYS_CLOSE 6

#define SYS_READ 3

#define SYS_LSEEK 19

#define SYS_GETDENTS 141

#define BUF_SIZE 1024

#define STDOUT 1

 struct linux_dirent {
           long           d_ino;
           int         d_off;

           unsigned short d_reclen;

           char           d_name[];

       };         

int main (int argc , char* argv[], char* envp[])

{

   int fd=0;

   int nread;

   char * nread_str;

   char buf[BUF_SIZE];

   struct linux_dirent *d;

           int bpos;

           char d_type;

  fd=system_call(SYS_OPEN,".", 0 , 0);
          for ( ; ; ) {

               nread = system_call(SYS_GETDENTS, fd, buf, BUF_SIZE);

               if (nread == -1)              

        system_call(SYS_WRITE,STDOUT, "error-getdents",BUF_SIZE);

               if (nread == 0)

                   break;

          system_call(SYS_WRITE,STDOUT, "--------------- nread=%d ---------------\n",100);

      nread_str=itoa(nread);      

          system_call(SYS_WRITE,STDOUT, nread_str,100);                      

          system_call(SYS_WRITE,STDOUT, "i-node#  file type  d_reclen  d_off   d_name\n",100);

               for (bpos = 0; bpos < nread;) {

                   d = (struct linux_dirent *) (buf + bpos);

                  /* printf("%8ld  ", d->d_ino);**/

                   d_type = *(buf + bpos + d->d_reclen - 1);

                  /* printf("%4d %10lld  %s\n", d->d_reclen,
                           (long long) d->d_off, (char *) d->d_name);**/
                   bpos += d->d_reclen;
               }
           }

}
  return 0;
}

```