home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / PPL4C11.ZIP / ALLOCSEG.C next >
Encoding:
C/C++ Source or Header  |  1995-11-18  |  318 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) + ((FP_OFF(Ptr)+15)>>4);
  15.  return Seg;
  16. }