Python os.fpathconf() 方法


Python os.fpathconf() 方法

#!/usr/bin/python

import os, sys

# Open a file
fd = os.open( "foo.txt", os.O_RDWR|os.O_CREAT )

print "%s" % os.pathconf_names

# Now get maximum number of links to the file.
no = os.fpathconf(fd, 'PC_LINK_MAX')
print "Maximum number of links to the file. :%d" % no

# Now get maximum length of a filename
no = os.fpathconf(fd, 'PC_NAME_MAX')
print "Maximum length of a filename :%d" % no

# Close opened file
os.close( fd)
print "Closed the file successfully!!"