1752584 Members
4190 Online
108788 Solutions
New Discussion юеВ

file descriptor to DIR *

 
pratima_2
Occasional Contributor

file descriptor to DIR *

Hi,

Is there any syscall on HP-UX which converts file decriptor (of type int) to Directory pointer (DIR *).
On solaris and Linux, there is fdopendir:
DIR *fdopendir(int fildes)
But this is not available on HP-UX.

I want to try avoiding opendir().

Thanks!
3 REPLIES 3
Bharat Katkar
Honored Contributor

Re: file descriptor to DIR *

See the link below for Directory Operations:

http://www.informatik.uni-frankfurt.de/doc/man/hpux/directory.3c.html

Hope that helps


You need to know a lot to actually know how little you know
pratima_2
Occasional Contributor

Re: file descriptor to DIR *

Hi,

None of the syscalls mentioned in the link you have given, does what I am expecting.

Also note : I know I can use opendir directly to ger DIR *.But in one specific case I want to use open and then convert fd to DIR * only if required.

Thanks!
A. Clay Stephenson
Acclaimed Contributor

Re: file descriptor to DIR *

Well, to be precise, fdopendir() is not a system call but rather is a library function. This is a BSD based function and there is no direct equivalent in the System V derivatives. This is a common problem when tryingh to port UNIX code; you really have to look at what tools are available on all the platforms and choose a common set of tools or else be prepared to fill the code with #ifdef's.
If it ain't broke, I can fix that.