Clearing output of a terminal program Linux C/C++

后端 未结 7 569
盖世英雄少女心
盖世英雄少女心 2020-11-27 14:29

I\'m interested in clearing the output of a C program produced with printf statements, multiple lines long.

My initial guess was to use

 printf(\"ou         


        
7条回答
  •  遥遥无期
    2020-11-27 15:28

    As far as C is concerned, stdout is nothing more than a byte stream. That stream could be attached to a CRT (or flat screen), or it could be attached to a hardcopy device like a teletype or even a sheet-fed printer. Calling rewind on the stream won't necessarily be reflected on the output device, because it may not make any sense in context of that device; think about what rewinding would mean on a hardcopy terminal or a sheet-fed printer.

    C does not offer any built-in support for display management, so you'll have to use a third-party library like ncurses.

提交回复
热议问题