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/chsize.c

19 lines
373 B
C

#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <sys/stat.h>
void main()
{
int handle;
handle = open( "file", O_RDWR | O_CREAT,
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP );
if( handle != -1 ) {
if( chsize( handle, 32 * 1024L ) != 0 ) {
printf( "Error extending file\n" );
}
close( handle );
}
}