#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <unistd.h>
|
int | truncatef (off_t length, const char *fmt,...) |
| Truncate a file based on the formatted string. More...
|
|
- Author
- Joachim Wiberg
- Date
- 2021
- Copyright
- ISC License
◆ truncatef()
int truncatef |
( |
off_t |
length, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Truncate a file based on the formatted string.
- Parameters
-
length | Size in bytes to truncate file to, zero to empty it |
fmt | Formatted string to be composed into a pathname |
This is an extension to the truncate() family, lessening the burden of having to compose the filename from parts in a seprate buffer.
- Returns
- Upon successful completion truncate() returns POSIX OK(0), otherwise, -1 is returned and errno is set to indicate error.