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

enum ImStatus CloseImage ( struct Image image  ) 

Write back a disk image.

image address of the disk image buffer (will be deallocated by this function)
Status of the operation

Definition at line 3007 of file image.c.

References Image::buf, getGeometry(), ImFail, ImNoSpace, ImOK, Image::name, and Image::type.

Referenced by main(), and writeFile().

  FILE* f;
  const struct DiskGeometry* geom;

  if (!image || !image->buf || !(geom = getGeometry (image->type)))
    return ImFail;

  if (!(f = fopen ((char*)image->name, "wb")))
    return errno == ENOSPC ? ImNoSpace : ImFail;

  if (1 != fwrite (image->buf, geom->blocks * 256, 1, f)) {
    fclose (f);
    return errno == ENOSPC ? ImNoSpace : ImFail;

  fclose (f);
  free (image->buf);
  image->buf = 0;
  return ImOK;

Generated by  Doxygen 1.6.0   Back to index