I would like to print a big matrix of data which I have in a linked list. It doesn't fit into a terminal (80 lines), so it is inconvenient to print it with standard printing functions; and less
is already invented, so I wouldn't want to be reinventing it using ncurses; so I want to pass some printf
d lines to less
.
My first guess would be to write to a file, and then system("less -S file");
, and then delete the file.
A more complicated solution would be to rewrite less so that its main()
is converted to a less()
function that I can call from C, and instead of a filename string I could provide it with a file descriptor or a stream.
Is there any way that doesn't involve needing to create a file and also not needing to rewrite (part of) less?