Browse Source

Fix fseek_ and ftell_ on Win32

- on Windows fseek_ returned always "the end" of a stream, added "fflush" to make it work again
Ronny Otto 10 năm trước cách đây
mục cha
commit
4fbf14d7d4
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      stdc.mod/stdc.c

+ 4 - 0
stdc.mod/stdc.c

@@ -190,11 +190,15 @@ int system_( BBString *cmd ){
 }
 
 int fseek_( FILE* stream, BBLONG offset, int origin ) {
+	// flush stream when using _fileno
+	fflush(stream);
 	int f = _fileno(stream);
 	return (_lseeki64(f, offset, origin) >= 0) ? 0 : 1;
 }
 
 BBLONG ftell_( FILE* stream ) {
+	// flush stream when using _fileno
+	fflush(stream);
 	int f = _fileno(stream);
 	return _telli64(f);
 }