Search code examples
cprintftabular

Updating table formatting in C language


I am using C language. I want to display a table. I know how to display a normal table using printf. However I have many records (more than several thousand), and I want to keep two things on screen all the time and have the middle portion of record keeps updating...

Suppose here is a table:

================================
No.| Name | Some Data | Comments
================================
001   xyz     234        abc
002   uvw     5862       abc
003   lmn     8993       abc
004
005
006
007
...
...
================================
Some result analysis goes here: 
================================

Now lets assume there are thousand of entries in this table, and in less than a second this table is updating, eventually what will happen? I will loose the header and footer of table like: No, Name , Some data and comments, and in footer result analysis..

What I want is to keep updating the entries but have the header and footer of the table remain. How can I implement this! Any idea?


Solution

  • Are you using a Unix/Linux system? If yes, probably you have ncurses library (man 3). It is a library to manipulate character interface.
    You are able to create 'windows' (screen sections) and update only this parts (to remain the header and footer).