Although you can use the filesystem C APIs to perform other tasks, the most common use of the filesystem C APIs is to write to and read from files.
Review the following information for an overview of the steps required to use filesystem C APIs in libMapRClient:
hdfsOpen() APIs and specifying a file that doesn’t exist. Opening a
file sets the current offset to 0, the first byte in the file. You can move file offset
explicitly with the hdfsSeek() API. Writes done by
hdfsWrite() and reads done by hdfsRead() increment the
offset by the number of bytes written or read. Use hdfsTell() to find
out what the current offset is.
For information about how to specify the location of a file to create or open, see Specifying Paths to Files and Directories.
When you read from a file, you pass a pointer to a buffer for storing the data that is read. Reads can be done from the default offset or from an offset that you specify. For more information about reads, see Reading from Files.
Closing a file implicitly flushes any remaining write buffers to the server. It also frees resources that are associated with the file.
For more detailed information about these steps, see: