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