0

I'm writing a program that needs to modify the terminal screen buffer without using printf or stdout. On win32 I did that by using CreateConsoleScreenBuffer() and SetConsoleActiveScreenBuffer() then writing to the console screen buffer using WriteConsoleOutputCharacter(). I want to do this on linux as well (kind of like how vim prints things out) but I can't find any way. It would also be great if there was a way to do this using the standard library!

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
Phillip
  • 135
  • 6

1 Answers1

0

OP says

without using printf or stdout

you could use stderr (which usually points to the same terminal), e.g.,

    echo '\033[H\033[J' >&2

to clear the screen while writing to stderr. Or you could use tput, e.g.,

    tput clear >&2
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105