home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / windows / misc / 1681 < prev    next >
Encoding:
Text File  |  1992-11-11  |  1.3 KB  |  39 lines

  1. Newsgroups: comp.windows.misc
  2. Path: sparky!uunet!uchdcc!dcc.uchile.cl!cmoraga
  3. From: cmoraga@dcc.uchile.cl (MORAGA ORELLANA, CORNELIO)
  4. Subject: Re: problems with a[i][j] within a function
  5. Originator: cmoraga@dcc.uchile.cl
  6. Sender: usenet@dcc.uchile.cl (Network News)
  7. Message-ID: <1992Nov11.172847.13525@dcc.uchile.cl>
  8. Date: Wed, 11 Nov 1992 17:28:47 GMT
  9. Organization: Universidad de Chile, Depto. de Ciencias de la Computacion
  10. Lines: 28
  11.  
  12. >     I am a complete novice to X-windows programming (although I know
  13. >C and unix and VMS systems programming at an intermediate level). I
  14. >need to take a 2-dimensional array of colormap indeces, corresponding
  15. >to a rectangular patch of the screen with pixels of different colors,
  16. >and throw it up as a window on a Ultrix VAX or a VMS Vax with
  17. >DecWindows (no MIT X stuff - just regular out-of-the-box DecWindows)
  18. >from a C program. Something like this:
  19. >display_in_window(array) 
  20.                   (array, dim1, dim2)
  21.                   function display_in_windows can't know dim1 and dim2
  22.                   if not it specified.
  23. >short array[X][Y];
  24. >{
  25.  
  26. >   /* here's the part I'm having trouble with */
  27.  
  28.     a_ij = array[i][j];  ==> error !!!
  29.  
  30.     it's better to use (though more complex) 
  31.     a_ij = ((short*)array)[i*dim2+j];   /* this is correct ! */
  32. >}
  33. >
  34.  [  ... ]
  35. >Mike Levin
  36. >
  37.      cmoraga@dcc.uchile.cl
  38. >
  39.