Workshop o mikrokontrolérech na SKSP 2024.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
454 B

3 months ago
/*
* UCW Library -- File Sizes
*
* (c) 1999--2012 Martin Mares <mj@ucw.cz>
*
* This software may be freely distributed and used according to the terms
* of the GNU Lesser General Public License.
*/
#include <ucw/lib.h>
#include <ucw/io.h>
ucw_off_t ucw_file_size(const char *name)
{
int fd = ucw_open(name, O_RDONLY);
if (fd < 0)
die("Cannot open %s: %m", name);
ucw_off_t len = ucw_seek(fd, 0, SEEK_END);
close(fd);
return len;
}