From the course: Code Clinic: C

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Coding a text-mode dashboard

Coding a text-mode dashboard - C Tutorial

From the course: Code Clinic: C

Start my 1-month free trial

Coding a text-mode dashboard

- [Narrator] My first solution doesn't really use a dashboard, which is okay for a basic C program. The core of the main function involves reading the data file, which I assume is unmodified from the original. The first row, the header row, is discarded at line 53. And at line 56, the current time is saved. The bulk of the function involves the while loop at line 58. A record is fetched from the buffer, and the extract function is called, which pulls out all the fields, and saves them into a data structure. By this point, the time stamp has been converted into a time tr unix epoch time value, and if the current time value equals the value posted in the data file, each field is output, one line at a time. A nested while loop at line 78 waits for the machine's next second to pop up, at which point the loop repeats, and the next record is read from the file. The extract function at line 88 takes the text string red from the file and slices it up into individual pieces. First, the…

Contents