Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

closedir(3) [plan9 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. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +-----------+---------------+---------+ |Interface | Attribute | Value | +-----------+---------------+---------+ |closedir() | Thread safety | MT-Safe | +-----------+---------------+---------+ CONFORMING TO
POSIX.1-2001, POSIX.1-2008, SVr4, 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 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. 2015-08-08 CLOSEDIR(3)

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. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +-----------+---------------+---------+ |Interface | Attribute | Value | +-----------+---------------+---------+ |closedir() | Thread safety | MT-Safe | +-----------+---------------+---------+ CONFORMING TO
POSIX.1-2001, POSIX.1-2008, SVr4, 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 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. 2015-08-08 CLOSEDIR(3)
Man Page

11 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Copying Folder, C program

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)
Discussion started by: MW99
0 Replies

2. Shell Programming and Scripting

PERL script -- calling 'sed' by passing 'variable value'.

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)
Discussion started by: ganapati
5 Replies

3. Programming

Program to search for a file on disk using c++

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)
Discussion started by: asamgosi
4 Replies

4. Shell Programming and Scripting

Sorting dates in Perl

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)
Discussion started by: robsonde
6 Replies

5. Shell Programming and Scripting

PERL - Copying ONLY files from one dir to another

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)
Discussion started by: jhamaks
2 Replies

6. Shell Programming and Scripting

PERL - Use of uninitialized value in pattern match (m//)

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)
Discussion started by: chris01010
3 Replies

7. Shell Programming and Scripting

How to rename (move) most recent files in directory?

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)
Discussion started by: siegfried
2 Replies

8. Programming

Concatenating Struct Value With Char In C

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)
Discussion started by: Azrael
5 Replies

9. Shell Programming and Scripting

Insert Text after one, two, three lines & so on..

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)
Discussion started by: imranrasheedamu
10 Replies

10. Programming

Pipe usage error while visiting directories

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)
Discussion started by: beginnerboy
2 Replies

11. Programming

Find Argv[i] in /bin and /sbin

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)
Discussion started by: realpath_issue
5 Replies