background image

A

函数名: allocmem     
  分配 DOS 存储段
  : int allocmem(unsigned size, unsigned *seg);
程序例:
#include <dos.h>
#include <alloc.h>
#include <stdio.h>

int main(void)
{
  unsigned int size, segp;
  int stat;

  size = 64; /* (64 x 16) = 1024 bytes */
  stat = allocmem(size, &segp);
  if (stat == -1)
     printf("Allocated memory at segment: %x\n", segp);
  else
     printf("Failed: maximum number of paragraphs available is %u\n",
            stat);

  return 0;
}
 
函数名: absread, abswirte  
功  能: 绝对磁盘扇区读、写数据
用  法: int absread(int drive, int nsects, int sectno, void *buffer);
 int abswrite(int drive, int nsects, in tsectno, void *buffer);
程序例:
/* absread example */

#include <stdio.h>
#include <conio.h>
#include <process.h>
#include <dos.h>

int main(void)
{
  int i, strt, ch_out, sector;
  char buf[512];