closedir(3C) Standard C Library Functions closedir(3C)NAME
closedir - close a directory stream
SYNOPSIS
#include <sys/types.h>
#include <dirent.h>
int closedir(DIR *dirp);
DESCRIPTION
The closedir() function closes the directory stream referred to by the argument dirp. Upon return, the value of dirp may no longer point to
an accessible object of the type DIR. If a file descriptor is used to implement type DIR, that file descriptor will be closed.
RETURN VALUES
Upon successful completion, closedir() returns 0. Otherwise, -1 is returned and errno is set to indicate the error.
ERRORS
The closedir() function may fail if:
EBADF The dirp argument does not refer to an open directory stream.
EINTR The closedir() function was interrupted by a signal.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Safe |
+-----------------------------+-----------------------------+
SEE ALSO opendir(3C), attributes(5), standards(5)SunOS 5.11 24 Jul 2002 closedir(3C)
Check Out this Related Man Page
CLOSEDIR(3) Linux Programmer's Manual CLOSEDIR(3)NAME
closedir - close a directory
SYNOPSIS
#include <sys/types.h>
#include <dirent.h>
int closedir(DIR *dirp);
DESCRIPTION
The closedir() function closes the directory stream associated with dirp. A successful call to closedir() also closes the underlying file
descriptor associated with dirp. The directory stream descriptor dirp is not available after this call.
RETURN VALUE
The closedir() function returns 0 on success. On error, -1 is returned, and errno is set appropriately.
ERRORS
EBADF Invalid directory stream descriptor dirp.
CONFORMING TO
SVr4, POSIX.1-2001, 4.3BSD.
SEE ALSO close(2), opendir(3), readdir(3), rewinddir(3), scandir(3), seekdir(3), telldir(3)COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
2008-09-23 CLOSEDIR(3)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Copying all the normal files from 1 folder to another on a unix platform. I pass in 1 or 2 arguments, the folder... (0 Replies)
Hi Friends,
I'm calling 'sed' command inside one perl script, which is to list directory names which are having some date value as their names (in the form YYYYMMDD) with in the range (start and end date).
#!/usr/bin/perl -w
use strict;
use warnings;
my $DATA = "/export/home/ganapa";
my... (5 Replies)
Hey guy,
Is it possible to write a program in c++ to search for file in a particular drive?
If so please provide the logic or the code
Thanks
:) (4 Replies)
I have a directory of backup files.
named like this:
ldap.data.04-06-2012.tar
ldap.data.03-06-2012.tar
ldap.data.02-06-2012.tar
ldap.data.01-06-2012.tar
ldap.data.31-05-2012.tar
ldap.data.30-05-2012.tar
ldap.data.29-05-2012.tar
ldap.data.28-05-2012.tar
ldap.data.27-05-2012.tar... (6 Replies)
I'm writing a Perl script which has its 1st step as to copy files from one directory to another directory. The Source directory has got files with extension, without extension, directories etc. But I want to copy ONLY files with no extension. The files with extensions and directories should not get... (2 Replies)
I have written a PERL script to read files from directory that the filename contains OT. It then takes each line of each file and prints the first 5 characters before the first occurence of a /.
Currently I am getting the error:
Use of uninitialized value in string at rowGrab.pl line 43.... (3 Replies)
I'm using cygwin32 on Windows.
DN is an environment variable pointed at my download directory.
This command works to move the single most recent file in my download directory to my current directory:
mv "`perl -e '$p = $ARGV; opendir $h, $p or die "cannot opendir $p: $!"; @f = sort { -M $a... (2 Replies)
After googling everything I could, the best I could do with this is get the following warning with -Wall:
gcc -Wall help.c -o help
help.c: In function ‘findpid':
help.c:29:25: warning: passing argument 2 of ‘strncat' from incompatible pointer type
strncat( pro, &str, 60);
... (5 Replies)
I want to insert "Text" in each file as a place where I mentioned below "Insert Text Here". These files are something like news of newspaper. Generally, newspaper headlines contain one or two lines.
I don't know how it can be identified whether Text is inserted after first line or second line.
... (10 Replies)
To begin with FYI, I really struggled with the question before asking to simplify as much as I can around 1 hour and to increase the code's readability I neglect error checks.
I intend to communicate parent and child using PIPE. In the following program I do traverse given path and its... (2 Replies)
Hello all, I am currently working on a package manager in C and am at the point where I am trying to check to see if the package is already installed. To do this I am taking the package name(s) as an argument using argv. The working code for doing this as follows:
#include <stdio.h>
#include... (5 Replies)