FreeBASIC  0.91.0
file_get_wstr.c
Go to the documentation of this file.
1 /* get # function for wstrings */
2 
3 #include "fb.h"
4 
6  (
8  fb_off_t pos,
9  FB_WCHAR *dst,
10  ssize_t dst_chars,
11  size_t *bytesread
12  )
13 {
14  int res;
15 
16  if( bytesread )
17  *bytesread = 0;
18 
19  if( !FB_HANDLE_USED(handle) )
21 
22  /* perform call ... but only if there's data ... */
23  if( (dst != NULL) && (dst_chars > 0) )
24  {
25  size_t chars;
26  res = fb_FileGetDataEx( handle, pos, (void *)dst, dst_chars, &chars, TRUE, TRUE );
27 
28  /* add the null-term */
29  if( res == FB_RTERROR_OK )
30  dst[chars] = _LC('\0');
31 
32  if( bytesread )
33  *bytesread = chars;
34  }
35  else
37 
38  return res;
39 }
40 
41 FBCALL int fb_FileGetWstr( int fnum, int pos, FB_WCHAR *dst, ssize_t dst_chars )
42 {
43  return fb_FileGetWstrEx( FB_FILE_TO_HANDLE(fnum), pos, dst, dst_chars, NULL );
44 }
45 
46 FBCALL int fb_FileGetWstrLarge( int fnum, long long pos, FB_WCHAR *dst, ssize_t dst_chars )
47 {
48  return fb_FileGetWstrEx( FB_FILE_TO_HANDLE(fnum), pos, dst, dst_chars, NULL );
49 }
50 
51 FBCALL int fb_FileGetWstrIOB( int fnum, int pos, FB_WCHAR *dst, ssize_t dst_chars, size_t *bytesread )
52 {
53  return fb_FileGetWstrEx( FB_FILE_TO_HANDLE(fnum), pos, dst, dst_chars, bytesread );
54 }
55 
56 FBCALL int fb_FileGetWstrLargeIOB( int fnum, long long pos, FB_WCHAR *dst, ssize_t dst_chars, size_t *bytesread )
57 {
58  return fb_FileGetWstrEx( FB_FILE_TO_HANDLE(fnum), pos, dst, dst_chars, bytesread );
59 }