The pwrite function performs the same action as write, except that it writes into a given position in the file without changing the file pointer. The first three arguments to pwrite are the same as for write, with the addition of a fourth argument offset for the desired position inside the file.