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

📄 a.c

📁 C编程获得程序本身路径
💻 C
字号:
# include <dos.h>
# include <stdio.h>
void main()
{
  unsigned int env_seg;
  unsigned char in=0;
  unsigned int  p=0;

  clrscr();
  env_seg=peek(_psp,0x2c);
  printf("The segment of the PSP is %X .\n",_psp);
  printf("The segment of the ENV is %X .\n",env_seg);
  printf("--------------------------------------");
  printf("\nEnvirons List:\n");
  while (*environ) printf("%s\n",*environ++);
  printf("--------------------------------------");
  printf("\nFull path of the execute file:\n    ");
  in=peekb(env_seg,p);
  while (in!=1)
  {
    p++;
    in=peekb(env_seg,p);
  }
  p+=1;
  while (in!=0)
  {
    p++;
    in=peekb(env_seg,p);
    putchar(in);
  }
  printf("\n--------------END---------------------\n");
}

⌨️ 快捷键说明

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