FreeBASIC  0.91.0
dev_file_write.c
Go to the documentation of this file.
1 /* file device */
2 
3 #include "fb.h"
4 
5 int fb_DevFileWrite( FB_FILE *handle, const void* value, size_t valuelen )
6 {
7  FILE *fp;
8 
9  FB_LOCK();
10 
11  fp = (FILE*) handle->opaque;
12 
13  if( fp == NULL ) {
14  FB_UNLOCK();
16  }
17 
18  /* do write */
19  if( fwrite( value, 1, valuelen, fp ) != valuelen ) {
20  FB_UNLOCK();
22  }
23 
24  FB_UNLOCK();
25 
26  return fb_ErrorSetNum( FB_RTERROR_OK );
27 }