+ return write_header(&w->hdr, w->out_fp);
+}
+
+/* Writes the WIM to a file. */
+WIMLIBAPI int wimlib_write(WIMStruct *w, const char *path, int image, int flags)
+{
+ int ret;
+
+ if (image != WIM_ALL_IMAGES &&
+ (image < 1 || image > w->hdr.image_count))
+ return WIMLIB_ERR_INVALID_IMAGE;
+
+ if (image == WIM_ALL_IMAGES)
+ DEBUG("Writing all images to `%s'\n", path);
+ else
+ DEBUG("Writing image %d to `%s'\n", image, path);
+
+ ret = begin_write(w, path, flags);