home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / alt / msdos / programm / 2048 next >
Encoding:
Text File  |  1992-07-20  |  2.3 KB  |  53 lines

  1. Newsgroups: alt.msdos.programmer
  2. Path: sparky!uunet!sequent!muncher.sequent.com!furballs
  3. From: furballs@sequent.com (Paul Penrod)
  4. Subject: Re: Far pointers (Help!!)
  5. Message-ID: <1992Jul21.051048.18762@sequent.com>
  6. Sender: usenet@sequent.com (usenet )
  7. Nntp-Posting-Host: crg8.sequent.com
  8. Organization: Sequent Computer Systems Inc.
  9. References: <1992Jul17.215354.24954@CS.ORST.EDU> <22471@hacgate.SCG.HAC.COM>
  10. Date: Tue, 21 Jul 92 05:10:48 GMT
  11. Lines: 40
  12.  
  13. In article <22471@hacgate.SCG.HAC.COM> bill@solaria (Bill Neisius) writes:
  14. >saidra@prism.CS.ORST.EDU (Raoul Said) writes:
  15. >: 
  16. >:     Say I have a far pointer and I want to read a large file to it.
  17. >: How can I do a : read(handle,far_pointer,size); when read requires a near
  18. >: pointer?  I know I have to cast or convert or something but I've tried 
  19. >: everything!  Thanks
  20. >
  21. >I don't think you can cast a far pointer to near, since the whole 'point'
  22. >of the far pointer is to access data beyond the range of the near pointer.
  23. You can cast a far pointer to a near, but there are two things to
  24. take into consideration before doing so. First, you will lose the
  25. top 16 bits of whatever value you had, and the compiler will
  26. complain. Secondly, I don't know how motorola handles this, but on
  27. Intel it is possible to do so, so long as the pointer is not a
  28. normalized pointer. That way when the top sixteen get pitched, you
  29. only loose the segment attached to the pointer, but you'd better
  30. make real sure the offset that is left is really what you want.
  31.  
  32. Pratically speaking you're really better off, not doing that and
  33. sticking to a more portable approach such as compiling in Large or
  34. Huge model and letting the compiler resolve the reference for
  35. read() with the correct model library.
  36.  
  37. >
  38. >On the other hand, I don't see anything in the description of read() that
  39. >says the buffer _has_ to be a near pointer...it just uses the default pointer
  40. >type for the current memory model.  Why not just recompile
  41. >the program with large memory model?  That way all pointers become far
  42. >and the problem should go away....
  43. >
  44. >Bill Neisius
  45. >bill@solaria.hac.com
  46.  
  47.  
  48. -- 
  49. --------------------------------------------------------------------
  50.             Bureaucracy: noun, plural - Bureaucracies.
  51.          The process of turning energy into solid waste.
  52. ---------------------------------------------------------------------
  53.