Logo Search packages:      
Sourcecode: djvulibre version File versions  Download package

size_t ByteStream::Stdio::write ( const void *  buffer,
size_t  size 
) [virtual]

Writes data to a ByteStream. This function {must} be implemented by each subclass of ByteStream#. At most size# bytes from buffer buffer# are written to the ByteStream. Function write# returns immediately if size# is zero. The actual number of bytes written is returned. Function write# may also return a value greater than zero but smaller than size# for internal reasons. Programs must be ready to handle these cases or use function {writall}. Exception {GException} is thrown with a plain text error message whenever an error occurs.

Reimplemented from ByteStream.

Definition at line 726 of file ByteStream.cpp.

  if (!can_write)
    G_THROW( ERR_MSG("ByteStream.no_write") ); //  Stdio not opened for writing
  size_t nitems;
    nitems = fwrite(buffer, 1, size, fp);
    if (nitems<=0 && ferror(fp))
#ifdef EINTR
      if (errno!=EINTR)
        G_THROW(strerror(errno)); //  (No error in the DjVuMessageFile)
  } while(true);
  pos += nitems;
  return nitems;

Generated by  Doxygen 1.6.0   Back to index