FreeBASIC  0.91.0
file_putstr.c
Go to the documentation of this file.
1 /* put # function for strings */
2 
3 #include "fb.h"
4 
5 int fb_FilePutStrEx( FB_FILE *handle, fb_off_t pos, void *str, ssize_t str_len )
6 {
7  int res;
8  ssize_t len;
9  char *data;
10 
11  /* get string data len */
12  FB_STRSETUP_DYN( str, str_len, data, len );
13 
14  /* perform call ... but only if there's data ... */
15  if( (data != NULL) && (len > 0) )
16  res = fb_FilePutDataEx( handle, pos, data, len, TRUE, TRUE, FALSE );
17  else
19 
20  /* del if temp */
21  if( str_len == -1 )
22  fb_hStrDelTemp( (FBSTRING *)str );
23 
24  return res;
25 }
26 
27 FBCALL int fb_FilePutStr( int fnum, int pos, void *str, ssize_t str_len )
28 {
29  return fb_FilePutStrEx(FB_FILE_TO_HANDLE(fnum), pos, str, str_len);
30 }
31 
32 FBCALL int fb_FilePutStrLarge( int fnum, long long pos, void *str, ssize_t str_len )
33 {
34  return fb_FilePutStrEx(FB_FILE_TO_HANDLE(fnum), pos, str, str_len);
35 }