Sponsored Content
Full Discussion: Opendir
Homework and Emergencies Homework & Coursework Questions Opendir Post 302740485 by Neo on Thursday 6th of December 2012 08:40:03 AM
Old 12-06-2012
Hello!

In case you forgot to read the forum rules, here is quick copy.

Quote:
RULES OF THE UNIX AND LINUX FORUMS


(1) No flames, shouting (all caps), sarcasm, bullying, profanity or arrogant posts.

(2) No negative comments about others or impolite remarks. Be patient.

(3) Refrain from idle chatter that does not contribute to the knowledge base. This does not apply to the forums in The Unix Lounge which are for off-topic discussions.

(4) Do not 'bump up' questions if they are not answered promptly. No duplicate or cross-posting and do not report a post or send a private message where your goal is to get an answer more quickly.

(5) Search the forums database with your keywords before asking.

(6) Do not post classroom or homework problems.

(7) No job postings from headhunters or recruiters except in The Unix Forums Job Board. See How to Post to The UNIX Forums Job Board for information on using the Job Board.

(8) No BSD vs. Linux vs. Windows or similar threads.

(9) Edit your posts if you see spelling or grammar errors (don't write in cyberchat or cyberpunk style). English only.

(10) Don't post your email address and ask for an email reply. Don't send a private message with a technical question. The forums are for the benefit of all, so all Q&A should take place in the forums.

(11) Post questions with descriptive subjects. For example, do not post questions with subjects like "Help Me!", "Urgent!!" or "Doubt". Post subjects like "Execution Problems with Cron" or "Help with Backup Shell Script".

(12) These are not hacker boards so hacker related posts will be promptly deleted or moderated.

(13) The forum administrators reserve the right to prune, move or edit posts that do not adhere to the rules or are technically inaccurate.

(14) The forum administrators reserve the right to remove users or change their posting status to read only without notice if any rules are not followed.

(15) No smoking in the forums.
Cheers.

The UNIX and Linux Forums
 

3 More Discussions You Might Find Interesting

1. Programming

opendir() + customly created directories

Gday all In a program I am designing, I am using opendir() to test whether entries under a certain directory are sub-directories or not. This method works fine for the directory itself (.) and the parent directory (..), however it does not work for any sub-directories I manually create. i.e.... (5 Replies)
Discussion started by: JamesGoh
5 Replies

2. Shell Programming and Scripting

PHP 5 solaris opendir failure

Hello! I've moved a web from my RHEL5 Apache/2.2.3 machine to a Sun Solaris 5.9 Apache/2.2.6 (Unix) PHP/5.2.5 mod_ssl/2.2.6 machine. The web worked just fine on the rhel5 machine and most of the php pages works fine on the solaris machine to but not the one where I read a directory and prints... (1 Reply)
Discussion started by: Esaia
1 Replies

3. Programming

Opendir

code: #include<iostream> #include <dirent.h> using namespace std; int main() { DIR*dir; dir = opendir("/"); if (dir !=NULL) { struct dirent * abcd; while ((abcd=readdir (dir))!=NULL) { cout << abcd -> d_name; } }} output : this gives the output of Directory "/" ques : (1 Reply)
Discussion started by: console
1 Replies
READDIR(3)						     Linux Programmer's Manual							READDIR(3)

NAME
readdir - read a directory SYNOPSIS
#include <sys/types.h> #include <dirent.h> struct dirent *readdir(DIR *dir); DESCRIPTION
The readdir() function returns a pointer to a dirent structure representing the next directory entry in the directory stream pointed to by dir. It returns NULL on reaching the end-of-file or if an error occurred. According to POSIX, the dirent structure contains a field char d_name[] of unspecified size, with at most NAME_MAX characters preceding the terminating null character. Use of other fields will harm the portability of your programs. POSIX-2001 also documents the field ino_t d_ino as an XSI extension. The data returned by readdir() may be overwritten by subsequent calls to readdir() for the same directory stream. RETURN VALUE
The readdir() function returns a pointer to a dirent structure, or NULL if an error occurs or end-of-file is reached. ERRORS
EBADF Invalid directory stream descriptor dir. CONFORMING TO
SVID 3, POSIX, BSD 4.3 SEE ALSO
read(2), closedir(3), dirfd(3), opendir(3), rewinddir(3), scandir(3), seekdir(3), telldir(3) 1996-04-22 READDIR(3)
All times are GMT -4. The time now is 04:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy