FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
dev_cons_open.c
Go to the documentation of this file.
1
/* file device */
2
3
#include "
fb.h
"
4
5
static
FB_FILE_HOOKS
hooks_dev_cons
= {
6
fb_DevFileEof
,
7
fb_DevStdIoClose
,
8
NULL
,
9
NULL
,
10
fb_DevFileRead
,
11
fb_DevFileReadWstr
,
12
fb_DevFileWrite
,
13
fb_DevFileWriteWstr
,
14
NULL
,
15
NULL
,
16
fb_DevFileReadLine
,
17
fb_DevFileReadLineWstr
18
};
19
20
int
fb_DevConsOpen
(
FB_FILE
*
handle
,
const
char
*
filename
,
size_t
filename_len )
21
{
22
switch
( handle->
mode
)
23
{
24
case
FB_FILE_MODE_INPUT
:
25
case
FB_FILE_MODE_OUTPUT
:
26
case
FB_FILE_MODE_APPEND
:
27
break
;
28
29
default
:
30
return
fb_ErrorSetNum
(
FB_RTERROR_ILLEGALFUNCTIONCALL
);
31
}
32
33
FB_LOCK
();
34
35
handle->
hooks
= &
hooks_dev_cons
;
36
37
if
( handle->
access
==
FB_FILE_ACCESS_ANY
)
38
handle->
access
=
FB_FILE_ACCESS_WRITE
;
39
40
handle->
opaque
= (handle->
mode
==
FB_FILE_MODE_INPUT
? stdin : stdout);
41
handle->
type
=
FB_FILE_TYPE_PIPE
;
42
43
FB_UNLOCK
();
44
45
return
fb_ErrorSetNum
(
FB_RTERROR_OK
);
46
}
rtlib
dev_cons_open.c
Generated on Thu Jan 23 2014 19:40:08 for FreeBASIC by
1.8.4