Explorar o código

Added ftruncate_

woollybah %!s(int64=5) %!d(string=hai) anos
pai
achega
7f0054a992
Modificáronse 2 ficheiros con 11 adicións e 1 borrados
  1. 4 1
      stdc.mod/stdc.bmx
  2. 7 0
      stdc.mod/stdc.c

+ 4 - 1
stdc.mod/stdc.bmx

@@ -11,12 +11,14 @@ SuperStrict
 
 Module Pub.StdC
 
-ModuleInfo "Version: 1.13"
+ModuleInfo "Version: 1.14"
 ModuleInfo "Author: Various"
 ModuleInfo "License: zlib/libpng"
 ModuleInfo "Modserver: BRL"
 ModuleInfo "Credit: Adapted for BlitzMax by Mark Sibly"
 
+ModuleInfo "History: 1.14"
+ModuleInfo "History: Added ftruncate_"
 ModuleInfo "History: 1.13 Release"
 ModuleInfo "History: Added totally awesome stat_() hack for '<' and '>' in Win32 paths"
 ModuleInfo "History: 1.12 Release"
@@ -201,6 +203,7 @@ Function feof_:Int( c_stream:Byte Ptr )="int feof( FILE* ) !"
 Function fgetc_:Int( c_stream:Byte Ptr )="int fgetc( FILE* ) !"
 Function ungetc_:Int( char:Int,c_stream:Byte Ptr )="int ungetc( int,FILE* ) !"
 Function fputs_:Int( str$,c_stream:Byte Ptr )
+Function ftruncate_:Int(c_stream:Byte Ptr, size:Long)
 
 'posix
 

+ 7 - 0
stdc.mod/stdc.c

@@ -326,6 +326,10 @@ BBLONG ftell_( FILE* stream ) {
 	return _telli64(f);
 }
 
+int ftruncate_(FILE* stream, BBLONG size) {
+	return _chsize_s(fileno(stream), size);
+}
+
 #else
 
 int getchar_(){
@@ -466,6 +470,9 @@ BBLONG ftell_( FILE* stream ) {
 	return ftello(stream);
 }
 
+int ftruncate_(FILE* stream, BBLONG size) {
+	return ftruncate(fileno(stream), size);
+}
 #endif
 
 int fclose_( FILE* stream ) {