Silversonic
Posts: 34
Joined: Wed Aug 27, 2014 8:42 pm

Auto-starting a cpp program that uses ncurses?

Sun Mar 08, 2015 3:48 am

My cpp program uses ncurses to display stuff in the center of the screen. Is it possible to make such a program auto-load on Pi start? Because I tried shoving

Code: Select all

home/pi/program
In to /etc/rc.local, but unfortunately when starting up my Pi the ncurses output doesn't act normal, instead my output is shifted to the bottom left a bit and this doesn't revert.

Also in /rc/etc.local is a script which changes the font output by the raspberry pi, but this is placed before my cpp program - so it shouldn't be affect it should it?

User avatar
DougieLawson
Posts: 39121
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Auto-starting a cpp program that uses ncurses?

Sun Mar 08, 2015 9:11 am

You need to use the full path with a leading slash (/) in rc.local.

Getting input and output from a background program with no tty attached as stdin & stdout isn't trivial.

It may work with
/home/pi/program > /dev/tty1 &

But you may need to run it with screen.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
Douglas6
Posts: 4860
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Auto-starting a cpp program that uses ncurses?

Sun Mar 08, 2015 12:50 pm

Or you might try setting up auto-login, and adding your program to ~./bash.rc.

Silversonic
Posts: 34
Joined: Wed Aug 27, 2014 8:42 pm

Re: Auto-starting a cpp program that uses ncurses?

Sun Mar 08, 2015 3:56 pm

Thanks for the help guys. ~/.bashrc did the trick.


One last additional thing. Is it possible while SSHing to make a script to output to the Pi's connected screen (rather than outputting on to Putty?)

Edit: Yes, sorry. It was in dougie's post. /home/pi/program > /dev/tty1

Return to “Beginners”