FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
file_hlock.c
Go to the documentation of this file.
1
/* low-level lock and unlock functions */
2
3
#include "../fb.h"
4
#include <io.h>
5
#include <windows.h>
6
7
#ifdef HOST_MINGW
8
#define fileno _fileno
9
#define get_osfhandle _get_osfhandle
10
#endif
11
12
int
fb_hFileLock
( FILE *
f
,
fb_off_t
inipos,
fb_off_t
size
)
13
{
14
return
fb_ErrorSetNum
( LockFile( (
HANDLE
)get_osfhandle( fileno( f ) ), inipos, 0, size, 0 ) ==
TRUE
?
15
FB_RTERROR_OK
:
FB_RTERROR_FILEIO
);
16
}
17
18
int
fb_hFileUnlock
( FILE *
f
,
fb_off_t
inipos,
fb_off_t
size
)
19
{
20
return
fb_ErrorSetNum
( UnlockFile( (
HANDLE
)get_osfhandle( fileno( f ) ), inipos, 0, size, 0 ) ==
TRUE
?
21
FB_RTERROR_OK
:
FB_RTERROR_FILEIO
);
22
}
rtlib
win32
file_hlock.c
Generated on Thu Jan 23 2014 19:40:08 for FreeBASIC by
1.8.4