<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>ncurses &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://wordpress.com/tag/ncurses/</link>
	<description>Feed of posts on WordPress.com tagged "ncurses"</description>
	<pubDate>Mon, 07 Jul 2008 10:24:15 +0000</pubDate>

	<generator>http://wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[conio.h for Linux]]></title>
<link>http://cristibalas.wordpress.com/?p=6</link>
<pubDate>Mon, 14 Apr 2008 21:25:36 +0000</pubDate>
<dc:creator>Cristi</dc:creator>
<guid>http://cristibalas.wordpress.com/?p=6</guid>
<description><![CDATA[conio.h is a header file used in old MS-DOS compilers to create Text User Interfaces (TUIs).
This fi]]></description>
<content:encoded><![CDATA[<p><code>conio.h</code> is a header file used in old MS-DOS compilers to create Text User Interfaces (TUIs).<br />
This file is not part of the C standard library, and NOT available in linux.<br />
However, a multiplatform (for Linux, Windows, POSIX, ...) library for creating a TUI is the <code>ncurses</code> library.<br />
You have a link at the end of the page to find out more.<br />
Here is how I used <code>ncurses</code> to emulate <code>conio.h</code>:<br />
<!--more--><br />
A while ago, i've developed a medium size project (a tetris game) in Boralnd C++ for DOS.<br />
After I've got Linux, i wanted to port it.. and i was surprised because i couldn't find a conio.h file to include<br />
so.. i wrote one.. it uses the <a href="http://www.gnu.org/software/ncurses/ncurses.html">ncurses</a> library,<br />
so you must install the libncurses package and the development headers (something like libncurses-dev).<br />
I have debian lenny/sid, and it's as easy as:<br />
<code><br />
# apt-get install libncurses5 libncurses5-dev<br />
</code></p>
<p>here is my simple version of conio.h (it can be expanded to add more functions from conio.h , but i only used those )<br />
[sourcecode language="cpp"]<br />
#ifndef _myconio_h_<br />
#define _myconio_h_<br />
#include <ncurses.h></p>
<p>/* colors */<br />
#define BLACK   8<br />
#define RED     COLOR_RED<br />
#define BLUE    COLOR_BLUE<br />
#define GREEN   COLOR_GREEN<br />
#define YELLOW  COLOR_YELLOW<br />
#define WHITE   COLOR_WHITE<br />
#define MAGENTA         COLOR_MAGENTA<br />
#define CYAN    COLOR_CYAN</p>
<p>/* functions */<br />
#define clrscr() (clear(), refresh())<br />
#define gotoxy(x,y) move((y)-1, (x)-1)<br />
#define textcolor(c) attrset(COLOR_PAIR(c))<br />
#define cprintf printw</p>
<p>void conio_init() {<br />
  int i;<br />
  initscr();<br />
  if(has_colors()) {<br />
    start_color();<br />
    for(i = 1; i < 8; i++)<br />
      init_pair(i, i, 0);<br />
    init_pair(8, 0, 0);<br />
  }<br />
}</p>
<p>void conio_done() {<br />
  endwin();<br />
}</p>
<p>#endif<br />
[/sourcecode]</p>
<p>So.. when you start the program you must call <code>conio_init();</code> and before exiting you must call <code>conio_done();</code></p>
<p>When you compile your program, you must add the <code>-lncurses</code> flag to gcc/g++, or it will give you linker errors.</p>
<p>You can find some related links here: <a href="http://en.wikipedia.org/wiki/Ncurses#External_links">http://en.wikipedia.org/wiki/Ncurses#External_links</a></p>
<p>That's it.. good luck, and if you have trouble, drop me a line.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Programando con ncurses]]></title>
<link>http://danimanx.wordpress.com/?p=35</link>
<pubDate>Tue, 08 Apr 2008 02:20:52 +0000</pubDate>
<dc:creator>danimanx</dc:creator>
<guid>http://danimanx.wordpress.com/?p=35</guid>
<description><![CDATA[El otro dia estaba buscando alguna forma de pocicionar en pantalla, poder limpiar pantalla y poder p]]></description>
<content:encoded><![CDATA[<p>El otro dia estaba buscando alguna forma de pocicionar en pantalla, poder limpiar pantalla y poder ponerles colores a las letras que yo quisiera para compilarlo con gcc.</p>
<p>En Windows si bien es cierto todo eso se puede hacer con la libreria conio.h, en linux no existe ese tipo de libreria, asi que buscando me encontre con un proyecto llamado <em><strong><a href="http://freshmeat.net/projects/uconio/">uconio</a></strong></em>, que intenta de alguna manera "emular lo que hace la conio.h", pero no al 100%.</p>
<p>Despues me tope con otra libreria llamada ncurses, que resulta que esta tiene estos tipos de datos que me sirven:</p>
<ul>
<li>refresh() // este sirve para hacer un refresco cuando se ponen muuchos printf</li>
<li>getch()  // este espera a algun caracter de letra para poder finalizar el programa</li>
<li>move ( y, x); // para poder pocicionar algo en las coordenadas del monitor</li>
<li>start_color(); // este sirve para poder empezar un tipo de color en algun printf</li>
</ul>
<p>Ahora, cuando se quiera comenzar a usar estos comandos especiales de la ncurses.h, siempre se tiene que empezar con initscr(); y se termina con endwin(); .</p>
<p>Tambien mientras este dentro de esos dos comandos, el printf se combierte en printw igual el scanf a scanw, por que ocino va a dar algunos problemillas.</p>
<p>Aca hay un ejemplo usando esta libreria:</p>
<blockquote><p><em>#include &#60;stdio.h&#62;<br />
#include &#60;ncurses.h&#62;<br />
int main()<br />
{<br />
int a,b,c;<br />
float f;<br />
char seleccion;<br />
initscr();<br />
do<br />
{</p>
<p>printw("&#62;&#62;&#62;&#62;&#62;&#62;&#62;&#62; Programa que ve si un numere es par o impar o lo suma&#60;&#60;&#60;&#60;&#60;&#60; \n");<br />
printw(" 1) comprobar numero si es par o impar \n");<br />
printw(" 2) sumar 2 numeros \n");<br />
printw(" 3) sacar grados farenheit a celcius\n");<br />
printw(" 4) sacar grados celcius a farenheit\n");<br />
printw(" 5) salir           \n");<br />
mvprintw(10,2,"Introdusca opcion  realizar : \n");<br />
scanw("%d",&#38;seleccion);<br />
refresh();<br />
switch(seleccion)<br />
{<br />
case 1:<br />
printw(" introdusca numero para ver si es par o impar \n");<br />
scanw("%d",&#38;a);<br />
if ( a%2 == 0)<br />
printw(" el numero es par\n ");<br />
else<br />
printw(" el numero es impar\n ");<br />
break;<br />
case 2:<br />
printw(" introdusca un numero : \n");<br />
scanw("%d",&#38;a);<br />
printw(" introdusca otro numero : \n");<br />
scanw("%d",&#38;b);<br />
c=a+b;<br />
printw(" el resultado de la suma es %d \n",c);<br />
break;<br />
case 3:<br />
printw("Introdusca un valor en celcuis para pasarlo a farenheit:\n");<br />
scanw("%d",&#38;c);<br />
f=(1.8*c)+32; //esta es la formula para poder pasar de celcius a farenheit pero tambien se puede    hacer alrevez asi<br />
//c=9/5*(f-32); para pasar de farenheit a celcius<br />
printw("%3.1d grados Celsiufs son %0.1f grados Fahrenheit\n",c,f);<br />
break;<br />
case 4:<br />
printw("Introdusca un valor en farenheit para pasarlo a celcius\n");<br />
scanw("%f",&#38;f);<br />
c=9/5*(f-32);<br />
printw("%3.1f grados farenheit son %3.4d grados celcius\n",f,c);<br />
break;</p>
<p>case 5:<br />
printw("bye bye!\n");<br />
return 0;<br />
break;</p>
<p>}<br />
}while (seleccion!='5');<br />
}</em></p></blockquote>
<p>Despues se tendria que compilar de esta forma <em><strong>gcc -lncurses fichero.c.</strong></em></p>
<blockquote></blockquote>
]]></content:encoded>
</item>
<item>
<title><![CDATA[alarmpy, an ncurses alarm clock]]></title>
<link>http://distarterops.wordpress.com/2007/12/09/ncurses-alarm-clock/</link>
<pubDate>Sun, 13 Jan 2008 09:36:27 +0000</pubDate>
<dc:creator>distarterops</dc:creator>
<guid>http://distarterops.wordpress.com/2007/12/09/ncurses-alarm-clock/</guid>
<description><![CDATA[My prized first generation Bondi Blue iMac running Debian makes a fine jukebox with cplay, but becau]]></description>
<content:encoded><![CDATA[<p>My prized first generation <a href="http://en.wikipedia.org/wiki/Bondi_blue_(color)">Bondi Blue</a> iMac running <a href="http://www.debian.org/">Debian</a> makes a fine jukebox with <a href="http://mask.tf.hut.fi/~flu/cplay/">cplay</a>, but because it wasn't originally running <a href="http://en.wikipedia.org/wiki/X_Window_System">X</a>, I had trouble turning it into a convenient and reliable alarm clock. <code>at</code> worked fine but was missing a sleep timer, and I had a lot of problems with <code>clockywock</code>.</p>
<p>All I wanted was a simple, alarm clock-style interface, the ability to run arbitrary programs as alarms, and a flexible sleep function. There has to be someone else out there running a box without <a href="http://en.wikipedia.org/wiki/X_Window_System">X</a> with a need for a decent alarm clock.</p>
<p>So long as you have a working Python (&#62;2.4), it should install fine with the usual <code>python setup.py install</code>. It's only been tested with Python2.5, but I think it should be fine on 2.4. It probably won't work without minor modification on python2.3 (as in OS X Tiger).</p>
<p>It can be invoked as <code>alarmpy 7 30</code> to set the alarm time for 7:30 and engage the alarm. All the commands are listed onscreen while it runs, but... to test that the alert command will run, press "t", stopping with "T". The hour and minute can be set manually with "h", "H", "m", and "M", and the sleep timer interval can be set with "s" and "S". To stop the alarm if sounding and exit, press "q". To sleep, press the spacebar, which resets the alarm and advances the alarm time by the sleep interval. There's no scheduling of dates or this fancy AM/PM thing.</p>
<p>To set options including the alert program that it runs, first run it once. It shits one <code>~/.alarmpyrc</code> (sorry). See that file for examples. For the alarm program, anything will do so long as it cleans up fine with a <code>SIGTERM</code>. There are some examples for awaking to NPR or <a href="http://www.datassette.net/datashat.html">Business Funk</a> with mplayer, VLC, mpg321. The output of the alert program goes to <code>/dev/null</code>, but the output can be kept by changing <code>ALARM_LOG</code> in the rc file.</p>
<p>I've been using it every day for more than a month. I'm sure it could be made to work on Mac OS X or Windows with recent versions of Python, but why would you use something like this in a nice graphical environment?</p>
<p>The files:<br />
<a title="alarmpy-0.1.zip" href="http://brendanadamson.com/distarterops/alarmpy/alarmpy-0.1.zip">alarmpy-0.1.zip</a><br />
<a title="alarmpy-0.1.tar.gz" href="http://brendanadamson.com/distarterops/alarmpy/alarmpy-0.1.tar.gz">alarmpy-0.1.tar.gz</a></p>
<p><a title="dscn1527b.jpg" href="http://distarterops.wordpress.com/files/2008/01/dscn1527b.jpg"><img src="http://distarterops.wordpress.com/files/2008/01/dscn1527b.jpg" alt="dscn1527b.jpg" /></a></p>
<p>In an xterm:<br />
<a title="alarmpy in an xterm" href="http://distarterops.wordpress.com/files/2008/01/grab.png"><img src="http://distarterops.wordpress.com/files/2008/01/grab.png" alt="alarmpy in an xterm" /></a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[le: simple, clean and powerful editor based on ncurses]]></title>
<link>http://anothersysadmin.wordpress.com/2007/11/07/le-simple-clean-and-powerful-editor-based-on-ncurses/</link>
<pubDate>Wed, 07 Nov 2007 17:58:50 +0000</pubDate>
<dc:creator>Vide</dc:creator>
<guid>http://anothersysadmin.wordpress.com/2007/11/07/le-simple-clean-and-powerful-editor-based-on-ncurses/</guid>
<description><![CDATA[Today I was looking for a way to give a user access to edit, and nothing more, a remote file on a Li]]></description>
<content:encoded><![CDATA[<p>Today I was looking for a way to give a user access to edit, and nothing more, a remote file on a Linux box (Debian, to be correct). There were lot of options:</p>
<ul>
<li><em>vim</em>: too complex to use</li>
<li><em>emacs</em>: just overkill</li>
<li><em>ee</em>: looks simple but in the end it is no</li>
<li><em>joe</em>: same as above</li>
<li><em>nano</em>: it was the better choice but I'd prefer something in ncurses</li>
</ul>
<p>Enter <em>le</em>. It has all what I wanted for my user: color output, ncurses-based interface when exiting (it displays a cute dialog asking if you want to save the modified file), it even supports easy mouse-based copy&#38;paste in a putty session!</p>
<p>So, after a few script lines and passwd changes, I have it the way I wanted.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[just a snippet: dialogs in linux]]></title>
<link>http://mindwarrior.wordpress.com/2006/12/28/just-a-snippet-dialogs-in-linux/</link>
<pubDate>Thu, 28 Dec 2006 14:29:44 +0000</pubDate>
<dc:creator>Poorna Shashank</dc:creator>
<guid>http://mindwarrior.wordpress.com/2006/12/28/just-a-snippet-dialogs-in-linux/</guid>
<description><![CDATA[just a small snippet for linux fun lovers. gl+hf
#!/bin/bash
{ i=0
while [ $i -lt 100 ]
do
echo $i
s]]></description>
<content:encoded><![CDATA[<p>just a small snippet for linux fun lovers. gl+hf</p>
<p><strong>#!/bin/bash<br />
{ i=0<br />
while [ $i -lt 100 ]<br />
do<br />
echo $i<br />
sleep 0.1<br />
i=`expr $i + 1`<br />
done<br />
echo;<br />
} &#124; dialog --guage "Loading..." 30 70 0</strong></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[VLC cli player]]></title>
<link>http://angrybee.wordpress.com/2007/12/25/vlc-cli-player/</link>
<pubDate>Tue, 25 Dec 2007 13:56:33 +0000</pubDate>
<dc:creator>angrybee</dc:creator>
<guid>http://angrybee.wordpress.com/2007/12/25/vlc-cli-player/</guid>
<description><![CDATA[You can run this command from the terminal:
vlc -I ncurses lista.m3u
This way you can use it also to]]></description>
<content:encoded><![CDATA[<p>You can run this command from the terminal:</p>
<p><code>vlc -I ncurses lista.m3u</code></p>
<p>This way you can use it also to see video files and dvd.</p>
]]></content:encoded>
</item>

</channel>
</rss>
