"Fossies" - the Fresh Open Source Software Archive 
Member "mp3info-0.8.5a/win32/truncate.c" (5 Jul 2003, 320 Bytes) of package /linux/misc/old/mp3info-0.8.5a.tgz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "truncate.c" see the
Fossies "Dox" file reference documentation.
1 #ifdef __MINGW32__
2
3 #include <fcntl.h>
4 #include <io.h>
5
6 int errno;
7
8 int truncate(const char *name, off_t length)
9 {
10 int fd, code, xerrno;
11
12 fd = open(name, O_WRONLY);
13 if(fd < 0)
14 return -1;
15 code = chsize(fd, length);
16 xerrno = errno;
17 close(fd);
18 errno = xerrno;
19 return code;
20 }
21
22 #endif