OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [test/] [misc/] [dirent.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
#include <stdio.h>
2
#include <stdlib.h>
3
#include <fcntl.h>
4
#include <dirent.h>
5
 
6
int main(int argc, char **argv)
7
{
8
 
9
    DIR *dirh;
10
    struct dirent *dirp;
11
    static char mydir[20] = "/tmp";
12
 
13
    if ((dirh = opendir(mydir)) == NULL) {
14
        perror("opendir");
15
        return 1;
16
    }
17
 
18
    for (dirp = readdir(dirh); dirp != NULL; dirp = readdir(dirh)) {
19
        printf("Got dir entry: %s\n",dirp->d_name);
20
    }
21
 
22
    closedir(dirh);
23
    return 0;
24
}
25
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.