out.write(pixels, datalen);
out.write((const char*)pixels, datalen);
static void Write_exult	(	ostream& out,			// What to write to.	char *basename,			// Base filename for files to read.	int nframes,			// # frames.	bool flat,			// Store as 8x8 flats.	char *palname			// Store palette with here if !0.	)	{	char *fullname = new char[strlen(basename) + 30];	int frnum;					// Save starting position.	unsigned long startpos = out.tellp();	if (!flat)		{		Write4(out, 0);		// Place-holder for total length.					// Also for frame locations.		for (frnum = 0; frnum < nframes; frnum++)			Write4(out, 0);		}	for (frnum = 0; frnum < nframes; frnum++)		{		sprintf(fullname, "%s%02d.png", basename, frnum);		cout << "Reading " << fullname << endl;		int w, h, rowsize, xoff, yoff, palsize;		unsigned char *pixels, *palette;					// Import, with 255 = transp. index.		if (!Import_png8(fullname, 255, w, h, rowsize, xoff, yoff,						pixels, palette, palsize))			throw file_read_exception(fullname);		int datalen = h*rowsize;// Figure total #bytes.		if (flat)			{			if (w != 8 || h != 8 || rowsize != 8)				{				cerr << "Image in '" << fullname <<					"' is not flat" << endl;				exit(1);				}			}		else			// Encode.			{			int xright = -xoff, ybelow = -yoff;			int xleft = w - xright - 1,			    yabove = h - ybelow - 1;			unsigned char *rle = Shape_frame::encode_rle(pixels,						w, h, xleft, yabove, datalen);			delete pixels;			pixels = rle;					// Get position of frame.			unsigned long pos = out.tellp();			out.seekp(startpos + (frnum + 1)*4);			Write4(out, pos - startpos);	// Store pos.			out.seekp(pos);			// Get back.			Write2(out, xright);			Write2(out, xleft);			Write2(out, yabove);			Write2(out, ybelow);			}		out.write(pixels, datalen);	// The frame data.		delete pixels;		if (palname)			{			Write_palettes(palname, palette, palsize);			palname = 0;			}		delete palette;		}	if (!flat)		{		unsigned long pos = out.tellp();// Ending position.		out.seekp(startpos);		// Store total length.		Write4(out, pos - startpos);		out.seekp(pos);			// And get back to end.		}	delete fullname;	}