From: SYSOP3%uhavax.dnet@uhasun.hartford.edu
Newsgroups: fj.mail-lists.x-window
Subject: Help with XReadBitmapFile
Date: 14 Aug 92 15:55:29 GMT
Distribution: fj
Organization: Workstation Div., Supermicro Systems Group, Sony Corporation

Date: Fri, 14 Aug 92 10:02:12 EDT
Message-Id: <9208141402.AA27653@uhasun.hartford.edu>
X-Original-From: uhavax::SYSOP3       "ALL I'M SAYIN IS PIE IS NEVER FREE"
X-Original-To: UHASUN::"xpert@athena.mit.edu"

 Everyone,
        I'm having a little trouble with a pretty simple display program
  I'm working on.I'm trying to use XReadBitmapFile to load an image file 
  I've created using the DecWindows Paint application. This application
  allows me to save the image file in the X11 format (I assume that the
  application uses WriteBitmapFile to accomplish this since the file looks
  to be in that format). The trouble is that I get an access violation
  error when XReadBitmapFile tries to open the image file. I hope you don't
  mind if I attach my routine and my data structure for your analysis.
  I am not the worlds greatest C programer and I'm sure Ive made a simple
  mistake somewhere. I would GREATLY appreciate any hints.

  The data structure looks like this
        struct wndow {
                char Command[5];
                Drawable window_ID;
								int x;
                int y;
                int height;
                int width;
                int x_hot;
                int y_hot;
                char image_file_name[MAX_LINE_SIZE];
        } window[100];

   the variable win_index is of type int declared earlier.
   the routine looks like this

static void load_image_file( )
{
 int status_value;
 char *filename;

 strcpy(&filename,window[win_index].image_file_name);
 status_value=XReadBitmapFile(dpy, window[win_index].window_ID,
							filename);

 if (status_value == BitmapFileInvalid)
     fprintf(stderr, "File %s contains invalid bitmap data\n",
											window[win_index].image_file_name);
 else if (status_value == BitmapOpenFailed)
     fprintf(stderr, "File %s could not be opened\n",
                      window[win_index].image_file_name);
 else if (status_value == BitmapNoMemory)
     fprintf(stderr, "Not enough memory to allocate pixmap\n");
}

   The error I get looks like this and it occurs just after the call to
	 XReadBitmapFile. As far as I can tell I'm passing the parameters as 
	the manual describes. I know that the variables are actually getting there.
	the error looks something like this

%SYSTEM-F-ACCVIO, access violation, reason mask=01, virtual address=61727073,
PC
=0009BD89, PSL=03C00005
%TRACE-F-TRACEBACK, symbolic stack dump follows
module name     routine name                     line       rel PC    abs PC

                                                           0009BD89  0009BD89
                                                           0008D755  0008D755
                                                           0003D9F5  0003D9F5
TEST10          load_image_file                 13314      00000064  00004FFC
TEST10          main                            13230      000000EF  00004CFB

	I would really appreciate any clues you might have.. Even if someone has an
  example of how to use this routine...
		Thanks in advance

																					eric truntz.
																	sysop3@uhavax.hartford.edu