Unix to Windows Porting Dictionary for HPC

Links

Function List

fchdir


Unix

header file: unistd.h

int fchdir (int fildes)

Windows

header file: n/a

Purpose

Change the current working directory to the open file descriptor 'fildes'.

Discussion

On Unix systems the fchdir() function is similar to the chdir() function except it uses an open file descriptor to change the current working directory for the process instead of a pathname.

On Windows there is not a matching function or one with similar functionality. The source code will need to be changed for Windows to track the pathname or preserve the pathname through the source code so that chdir() maybe called instead. This is the typical workaround. Often a global variable will be used specifically for this purpose and access to the variable may be guarded by locks if used in more than one thread.

blog comments powered by Disqus