Writing to 0xb8000000 yields output on screen without any print statements such as `printf`

前端 未结 6 774
时光取名叫无心
时光取名叫无心 2020-12-15 12:35
#include 
#include 

void main()
{
  char far *v = (char far*)0xb8000000;
  clrscr();

  *v = \'w\';
  v += 2;
  *v = \'e\';

  getch()         


        
6条回答
  •  清歌不尽
    2020-12-15 12:45

    You didn't specify what platform it is, and it's apparently not one that would crash this nasty code.

    0xb8000000 on the legacy DOS platform was the video memory buffer, so in text mode, you could write characters there directly. See here: http://wiki.answers.com/Q/What_is_0xB8000000

提交回复
热议问题