farreall.c

来自「vc library 韩国语版 希望对大家又帮助」· C语言 代码 · 共 27 行

C
27
字号
#include <stdio.h>
#include <alloc.h>
#include <string.h>
#include <dos.h>
#include <stdlib.h>
void main()
{
  char far *fptr;
  char far *fptr2;
  char *str = "Korea is One ";
  char *str2= "abcdefghijklmnopqrstuvwxyz";
  fptr = (char far *) farmalloc(20);
  movedata(FP_SEG(str), FP_OFF(str),
	   FP_SEG(fptr), FP_OFF(fptr), strlen(str));
  printf("Far string is: %Fs\n", fptr);
  fptr2 = (char far *) farrealloc(fptr,50);
  if (fptr2==NULL)
    {
    printf("Out of memory\n");
    exit(0);
    }
  movedata(FP_SEG(str2), FP_OFF(str2),
	   FP_SEG(fptr2), FP_OFF(fptr2), strlen(str2));
  printf("Far string2 is: %Fs\n", fptr2);
  farfree(fptr);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?