This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/clibexam/fstat.c

20 lines
361 B
C

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <io.h>
void main()
{
int handle, rc;
struct stat buf;
handle = open( "file", O_RDONLY );
if( handle != -1 ) {
rc = fstat( handle, &buf );
if( rc != -1 )
printf( "File size = %d\n", buf.st_size );
close( handle );
}
}