Skip to Content
Hands-On Robotics Programming with C++
book

Hands-On Robotics Programming with C++

by Dinesh Tavasalkar
March 2019
Intermediate to advanced
312 pages
7h 37m
English
Packt Publishing
Content preview from Hands-On Robotics Programming with C++

Writing a HelloWorld program with ncurses

Let's now write a simple ncurses program for printing Hello World. I have named this program HelloWorld.cpp. The HelloWorld.cpp program can be downloaded from the Chapter05 folder of the GitHub repository:

#include <ncurses.h>#include <stdio.h>int main(){initscr(); //initializes and clear the screenint keypressed = getch(); if(keypressed == 'h' || keypressed == 'H'){printw("Hello World"); //will print Hello World message}getch();refresh(); endwin(); // frees up memory and ends ncursesreturn 0;}

The program for compiling and running a C++ program using the ncurses library is different from other programs. First, we need to understand the program. After that, we will learn how to compile and run it. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learn Robotics Programming

Learn Robotics Programming

Danny Staple
C++ Reactive Programming

C++ Reactive Programming

Praseed Pai, Peter Abraham

Publisher Resources

ISBN: 9781789139006Supplemental Content