Supported by libMapRClient for hadoop-0.20.2 and hadoop-2.x

Closes an open file. Flushes all pending write buffers for the file and releases resources that are associated with the file.


int hdfsCloseFile(hdfsFS fs, hdfsFile file)



The handle of the filesystem where the file is located. Obtain this handle with one of the hdfsConnect() APIs.


The file handle. Obtain this handle with one of the hdfsOpenFile() APIs.

Return Value

Returns 0 on success, -1 on error.

Check errno for error codes and meanings.