FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
dev_file_readline_wstr.c
Go to the documentation of this file.
1
/* wstring LINE INPUT for file devices */
2
3
#include "
fb.h
"
4
5
int
fb_DevFileReadLineWstr
(
FB_FILE
*
handle
,
FB_WCHAR
*dst, ssize_t dst_chars )
6
{
7
int
res;
8
FILE *fp;
9
FBSTRING
temp = { 0 };
10
11
FB_LOCK
();
12
13
fp = (FILE *)handle->
opaque
;
14
if
( fp == stdout || fp == stderr )
15
fp = stdin;
16
17
if
( fp ==
NULL
)
18
{
19
FB_UNLOCK
();
20
return
fb_ErrorSetNum
(
FB_RTERROR_ILLEGALFUNCTIONCALL
);
21
}
22
23
res =
fb_DevFileReadLineDumb
( fp, &temp,
NULL
);
24
25
/* convert to wchar, file should be opened with the ENCODING option
26
to allow UTF characters to be read */
27
if
( (res ==
FB_RTERROR_OK
) || (res ==
FB_RTERROR_ENDOFFILE
) )
28
fb_WstrAssignFromA
( dst, dst_chars, (
void
*)&temp, -1 );
29
30
fb_StrDelete
( &temp );
31
32
FB_UNLOCK
();
33
34
return
res;
35
}
rtlib
dev_file_readline_wstr.c
Generated on Thu Jan 23 2014 19:40:08 for FreeBASIC by
1.8.4