Can anybody tell me what is the exact difference between readdirand readdir_r?I have written a small program using readdir which is working fine: It's generating all the files and directory in the current directory.Now I want to know how readdir_r works, and how is it different from readdir.Please show with some example.Thanks in advance, haris
Please use linebreaks and punctuation. I'm not a grammar nazi, but your post was very difficult to understand at all without them.
Please use code tags for code, [ code ] stuff [ /code] without the extra spaces. It makes it easier to read, and stops the forum from eating your #include tags.
Please make new threads for new topics instead of dumping new questions into tangentially related threads.
readdir() is not context-safe. The data in the pointer it returns gets overwritten every time you call it. If you opened two directories at the same time like this:
...both p1 and p2 would point to the same data: Whatever the last readdir() found.
readdir_r() avoids this by writing data to wherever you tell it instead of giving you a pointer to its own memory.
This way, p1 and p2 both contain the expected data, instead of just containing whatever the last value read by readdir() was.
i have just installed suse 8.1 on a third computer which has an Asus p4s8x with onboard NIC and sound. now, on install suse detected everything automatically with no probelm, however upon reboot the sound failed to load as well as the network card. /dev/eth* doesnt exist. i looked in the bios and... (2 Replies)
i got a NV11 geForce2 100/200 and suse 9.0 pro boot the kernal but then the screen
goes blank and nothing else can't install suse 9.0 pro and grabs for this problem
x will not come up at all
just the boot screen with rez and so on but once i tell it to install thats i have a nec multisync... (6 Replies)
Hello,
So, I burned the 5 cds of SuSE 10.1, and would really like to begin installation.
But when I get to the partitioning phase, I get an error message saying the first hard drive is unreadable by parted, and that I'll have to use Yast instead. It also tells me I wont be able to move delete... (0 Replies)
I read the description of the command readdir by using 'man readdir'. However, in the description i was suggesed to refer to readdir(3).
I wonder how to see the manual of readdir(3)
Thanks (1 Reply)
I am having a hard time doing this and can't seem to find an example to help me. This is my code:
DIR *dirp=opendir(pathname);
struct stat filebuf;
struct dirent entry;
struct dirent *dp=&entry;
RWCString pattern;
for (int i = 0; i < request_->getNumStreams(); i++)
{
... (2 Replies)
hi Guys,,
Am very new to Linux OS.. This is my first experience with Linux.
I have installed linux suse 10 in my laptop.it was working fine.. suddenly after 3 days,(i was changing some options of the already installed linux) when i login, i am getting only command interface and GUI is not... (2 Replies)
Quick question.
I can not get the context corrert on this code.
opendir(DIR, ".");
@fileldiv = grep(/l*/,readdir(DIR));
closedir(DIR);
I am trying to search all html files within a dir that start with l.
Thanks for your help. (1 Reply)
I have a process that needs two active connections to the same zone of shared memory simultaneously.
The firs conection works ok, but when i do the second call to shmat it give me error 22 (EINVAL). Only works ok the second call to shmat if i disconnect the first connection (shmdt)
Steps:... (3 Replies)
I setup a RAID 5 with 5 drives, one failed, hardware failure so I physically removed it from the raid after powering the machine off then powered it back on and my raid was still good but no 5th drive. I built a 5th drive from scratch and added it in the raid thinking the raid would go into... (0 Replies)
Hi all,
I'm trying to install of Gbrowse recently. Unfortunately, I stuck at the step to install GD which are prerequisite for Gbrowse installation.
I got try to install it, but it seems like got a lot of error message occurred :(
And still can't fix the problem yet.
I'm using ia64 linux... (10 Replies)