Problems by listing files opendir (".")

Joel Sherrill joel.sherrill at OARcorp.com
Fri May 4 14:42:04 UTC 2001


Markus Schmitz wrote:
> 
> Hello,
> 
> I run RTEMS on cygwin.
> I tried to list the files in a directory,
> but all I got were empty strings?

Is the target also Cygwin?  If so, then I suspect, this is the
expected behavior since file IO is not supported on the UNIX
simulation ports.

> #include <stdio.h>
> #include<bsp.h>
> #include<sys/types.h>
> #include<sys/stat.h>
> #include<dirent.h>
> #include<stdio.h>
> #include<unistd.h>
> #include<stdlib.h>
> #include<string.h>
> #include<errno.h>
> #include <fcntl.h>
> 
> rtems_task Init(rtems_task_argument ignored)
> {
>   DIR *dp;
>   struct dirent *dirp;
>   dirp = new dirent;
> 
>   if ( (dp = opendir (".")) == NULL)
>     {printf("can`t open Directory");}
>   else
>     {
>       while( (dirp = readdir(dp)) != NULL)
>         {
>            printf("d_ino %d, d_off %ld d_reclen %d d_namlen
> %d d_name %s\n", dirp->d_ino, dirp->d_off,
> dirp->d_reclen, dirp->d_namlen, dirp->d_name);
>         }
>      }
>   closedir(dp);
>   exit(0);
> }
> 
> /* configuration information */
> #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 100
> #define CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM
> #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
> #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
> #define CONFIGURE_MAXIMUM_TASKS 10
> #define CONFIGURE_MAXIMUM_PERIODS 1
> #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
> #define CONFIGURE_MAXIMUM_SEMAPHORE 2
> #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
> #define CONFIGURE_INIT
> #include <confdefs.h>
> 
> $ lstest6.exe
> d_ino 1627903676, d_off 1627903676 d_reclen 0 d_namlen
> 0 d_name
> d_ino 1627903676, d_off 1627903676 d_reclen 0 d_namlen
> 0 d_name
> d_ino 1627903676, d_off 1627903676 d_reclen 0 d_namlen
> 0 d_name
> d_ino 1627903676, d_off 1627903676 d_reclen 0 d_namlen
> 0 d_name
> d_ino 1627903676, d_off 1627903676 d_reclen 0 d_namlen
> 0 d_name
> 
> Thanks
>   Markus
> 
> __________________________________________________________________
> Do You Yahoo!?
> Gesendet von Yahoo! Mail - http://mail.yahoo.de

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985



More information about the users mailing list