mirror of
https://sourceware.org/git/glibc.git
synced 2025-12-24 17:51:17 +03:00
initial import
This commit is contained in:
25
manual/examples/dir.c
Normal file
25
manual/examples/dir.c
Normal file
@@ -0,0 +1,25 @@
|
||||
/*@group*/
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
/*@end group*/
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
DIR *dp;
|
||||
struct dirent *ep;
|
||||
|
||||
dp = opendir ("./");
|
||||
if (dp != NULL)
|
||||
{
|
||||
while (ep = readdir (dp))
|
||||
puts (ep->d_name);
|
||||
(void) closedir (dp);
|
||||
}
|
||||
else
|
||||
puts ("Couldn't open the directory.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user