home *** CD-ROM | disk | FTP | other *** search
/ PC Media 4 / PC MEDIA CD04.iso / share / prog / pcl4c42 / allocseg.c next >
Encoding:
C/C++ Source or Header  |  1994-08-21  |  319 b   |  16 lines

  1. /* allocseg.c */
  2.  
  3. #include <stdio.h>
  4. #include <malloc.h>
  5. #include <dos.h>
  6.  
  7. int AllocSeg(int Size)
  8. {int Seg;
  9.  char far *Ptr;
  10.  /* allocate far heap */
  11.  Ptr = (char far *) _fmalloc(Size+16);
  12.  if(Ptr==NULL) return 0;
  13.  /* SEG:0 points to buffer */
  14.  Seg = (FP_SEG(Ptr) + 1) + (FP_OFF(Ptr)>>4);
  15.  return Seg;
  16. }