The ftruncate function truncates a file at the specified position. For record files, the position must be a record boundary. Also, the files must be local, regular files. If the file was previously larger than length, extra data is lost. If the file was previously shorter than length, bytes between the old and new lengths are read as zeros.