⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lmem.bak

📁 蓝宇BBPC-SOM2496嵌入式主板 突破DOS内存限制实例代码与函数
💻 BAK
字号:
 #include <stdio.h>
 #include <alloc.h>
 #include <string.h>
 #include <dos.h>

 int main(void)
 {
    char far *fptr;
    char *str = "Hello";

    /* allocate memory for the far pointer */
    fptr = (char far *) farcalloc(1, 750000L); /*从堆里分配1个内存块,大小为750,000字节*/
    if(fptr == NULL)
    {
        printf("calloc fail!\n");
    }
    /* copy "Hello" into allocated memory */
    /*
       Note: movedata is used because you might be in a small data model, in
       which case a normal string copy routine can not be used since it
       assumes the pointer size is near.
    */
    movedata(FP_SEG(str), FP_OFF(str),FP_SEG(fptr), FP_OFF(fptr),strlen(str));

    /* display string (note the F modifier) */
    printf("Far string is: %Fs\n", fptr);

    /* free the memory */
    farfree(fptr);

    return 0;
 }

⌨️ 快捷键说明

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