Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!tcdcs!swift.cs.tcd.ie!ccvax.ucd.ie!eweb From: eweb@ccvax.ucd.ie Newsgroups: comp.lang.c Subject: Saving bitmaps to file in Microsoft C Message-ID: <752.25eb0b3a@ccvax.ucd.ie> Date: 27 Feb 90 23:20:26 GMT Organization: University College Dublin Lines: 36 My problem is that I'm trying to write bitmaps, to a file for future use. The program compiles okay but doesn't read the images back in. If I introduce a bug into the program, (e.g. an undeclared variable) I get warnings about converting near pointers to far pointers. int x1, y1, x2, y2; unsigned int size; void *ptr; size = (unsigned int) _imagesize(x1,y1,x2,y2); ptr = malloc(size); _getimage(x1,y1,x2,y2,ptr); fwrite(&size, sizeof(unsigned int), 1, fp); fwrite(ptr, size, 1, fp); and then later fread(&size, sizeof(unsigned int), 1, fp); ptr = malloc(size); fread(ptr, size, 1, fp); _putimage(x1,y1,ptr,_GXOR); I'd prefer to know what I'm doing wrong, but if you can provide code, but can't provide an answer, well I'm not that proud.... Eamonn Webster eweb@ccvax.ucd.ie Department of Computer Science eweb@ccvax.bitnet University College Dublin Belfield Dublin 4 Ireland I never had an original thought in my life, so views expressed must be someone else's....