Programming :: Differences Between Ncurses Library And Termios Struct W.r.t Keyboard Reading

May 3, 2010

I want to read a pressed key or a combination of pressed keys from the keyboard and perform some action afterwords.



Out of ncurses lib. and the termios struct which can be used best for the above purpose and why ?I tried to search on Google, the differences between these two but couldn't get much !

View 6 Replies


Programming :: Reading API Files From SO Library

Jul 27, 2010

If we have a .so library elf in linux, will it be possible to find out the APIs supported by it. Or in other words, the functions that can be used along with the argument types and return type.? Note that we dont have any other header files or documentations related to the library.

View 5 Replies View Related

Programming :: Keyboard Confirmation While Reading From File In Shell Script

Feb 3, 2010

I'm writing a script and I'm stuck. I need to read from keyboard to ask for confirmation while Im reading from a file. My code is this:

while read linea
do #code
echo "you sure? (y/n)"
read answer
done < $"agenda.dat"

The problem is that stdinput has been redirected to file agenda.dat so when I do "read answer" it reads the next line from the file.

View 11 Replies View Related

Programming :: Termios Programming - Without Removing Carriage Return / Enter Key

Jun 30, 2010

I trying to write a UART(interfacing of serial devices) to linux machine but after I execute the following code to receive data I need to enter key (carriage return).... but I don't want to remove carriage return/enter key


View 13 Replies View Related

Ubuntu :: Getting "checking For Library Stdc++ No" When Trying To Compile Ncurses On Lucid

Jun 27, 2010

I do have libstdc++6 and libstdc++6-4.4-dev installed though. I can't seem to figure out why it wouldn't detect it. Is it just a bug in ncurses' configure or what?

View 5 Replies View Related

Programming :: Applying Configuration To Serial Port - Strict Termios

Dec 28, 2010

I'm using the serial port of a device to communicate with a hardware. (that can assume some different configurations of baud rate, data bits, etc.) Well, I can obtain that configuration, but I'm not certain in how to apply them to the serial. I'm using the struct termios to do that. I did some search, and found how to configure the baud rate and data bits. I'm doing this:


how I set the stop bits (1, 1.5 or 2 bits), the parity (even, odd, none, mark or space) and the flow control (hardware, software, none or xon/xoff)?

View 1 Replies View Related

Programming :: Cannot Get Ncurses To Delete Char With

Jan 6, 2010

I've modified a program to show * instead of letters when typing a password. I'm trying to make it so that when pressing backspace a * will be removed.Here's a rough example. The problem is that when trying to do this in the real program,' is not recognized as backspace.

View 6 Replies View Related

Ubuntu :: Library For Pdfs + Reading Option?

Jul 25, 2011

I just saw library application of ipad, and i am wonder if there is any application for ubuntu like that?I searched on web and found somethings like :


but these apps just show some data of e-books like author, publishers , ...i need something that adds pdf files that are IN MY HARD drive
presents them and lets me to read them

View 2 Replies View Related

Programming :: STL Container Into A C Struct

May 23, 2011

I have an old C application in which i am trying to include some STL cointainers. When i use the STL container alone it works fine, but when i include it into a C struct i have segmentation faults errors. I know that it is not a good idea to mix C and C++. Considering this code:


typedef struct{
int shmid;


and how to make a malloc for this issue; something like :


mem->applSpace.rData.completeGroups2zeroGroup=(map_completeGroups2zeroGroup_type *)malloc((sizeof(map_completeGroups2zeroGroup_type)+1)* sizeof(char ));

View 11 Replies View Related

Programming :: Ncurses: Filling Window With Background?

Apr 6, 2010

I have some ideas about writing a small game in terminal ( just for fun ) using ncurses library. I want to use some kind of menus (in Midnight Commander's style), but there are some problems with rendering windows, that I don't understand. I create a window with newwin(), assign a color pair to it calling wattron() (for example, I want to fill a window with blue background), and then I call my own function wnd_fill() :

Code: void wnd_fill (WINDOW* wnd)
int i;


View 9 Replies View Related

Programming :: Ncurses Based Program Had To Be Recompiled On A Different PC Same OS

Oct 18, 2010

On an Ubuntu Server I am running, I wrote a small Ncurses program in GCC. It worked just fine.

Then, I copied the executable over to my Ubuntu 10.10 desktop edition with sftp. No matter what I did, it kept giving the error:

error opening terminal: xterm.

I had copied other non-curses programs and they all ran just fine.

Finally, I copied over the source, recompiled with GCC and voila, the executable now runs fine.

View 6 Replies View Related

Programming :: Ncurses Screen Prints Garbage

Feb 9, 2011

I actually have two reasons for posting this. One is to see if there's an actual name for characters like this:Hopefully that will show up correctly for you. If not, it's a little box with four numbers in it, one in each corner. I don't know their name or their reason for showing up, so it's hard to look for help.

My main problem, though, is that I wrote a program that prints some output to a console using ncurses as it runs. These characters show up on the console, seemingly at random, and disturb the whole thing. Sometimes I'll also get sets of characters like "[13;" I'm not printing anything bizarre on there, just strings and floating-point numbers.

View 6 Replies View Related

Programming :: Use A Class Inside A Struct?

Apr 8, 2011

Is is possible to use a class inside a struct? I keep getting segmentation fault with this code:


struct my_struct {
unsigned count;
std::string msg;


View 3 Replies View Related

Programming :: Difference Between Struct And Union?

Nov 6, 2010

I have been spending time (starting yesterday) reverse-engineering GTK+ to get my programming skills up. I came across a struct in the headers (_GtkArg, which was then typedeffed into GtkArg) that includes a union in it that has pretty much the same properties as a struct. Then, there was a struct inside the union.

I'm confused. Just what is the difference between a union and a struct?

P.S. I am using GTK's native C programming language.

View 8 Replies View Related

Programming :: Memory Allocation For Struct In C++?

Mar 30, 2010

How do we allocate memory of struct? what i did was


int main()
struct amp


cout <<"The size of 'struct' is"<< sizeof(struct amp)<<"and it is located at"<<struct amp*s = malloc(sizeof(struct amp))<<endl;
it gives me an error---
In funtion 'int main()':
error: expected primary-expression before 'struct'
error: expected ';' before 'struct'

View 9 Replies View Related

Programming :: Python Serial And Struct On 64 Bit?

May 14, 2010

For a work project, I've got a bunch of python code from about a year ago that controls the movement of our EVI-D30 camera over a ttyUSB connection. It used to work fine on a 32-bit Fedora box, but recently we moved our whole project over to a 64-bit Gentoo server, and the same code seems to be worthless on the new platform. I didn't write the code, so I'm have trouble figuring out how to fix it. Error messages usually look like this:


File "./", line 172, in pan
turn_callback(cmdStruct[0], cmdStruct[1])
File "./", line 147, in turn_callback


View 13 Replies View Related

Programming :: Stl Vector As A Member Of A Struct?

Jan 17, 2011

is there any problem that might rise by by having a vector as a member of struct in c++ as follows.ex.

struct A
int a;


View 2 Replies View Related

Programming :: Access Value From Nested Struct <c Language>?

Mar 11, 2010

I having a nested structures which are referenced with pointer variables :

example :
typedef struct {
int a ;
char *b ;
int *c ;
}EXP2 ;


While trying to access the value of sv.exp2->a it throws segmentation fault error.How to acess this variable ??

View 3 Replies View Related

Programming :: Sizeof Struct With Function Pointers As A Member?

Jul 2, 2010

I following structure
typedef struct


View 5 Replies View Related

Programming :: Dereferencing Pointer To A Shared Memory Struct?

Feb 5, 2011

I have what should be a relatively simple program (fadec.c) that maps a struct from an included header file (fadec.h) to a shared memory region, but Im struggling accessing members in the struct from the pointer returned by shmat. Ultimately, I want to access members in the shared memory structure with a globally declared version of the struct, shm__. Not only do I not know how to accomplish that, but I cant even seem to access members of the shared struct directly from the pointer itself (compiler complains about dereferencing pointer to incomplete type). Im at a loss and could use another set of eyes if you guys dont mind taking a gander:

Compile Errors:
tony-pc:/cygdrive/p/test> cc -o fadec fadec.c
fadec.c: In function 'main':
fadec.c:30: error: dereferencing pointer to incomplete type
fadec.c:31: error: dereferencing pointer to incomplete type


View 1 Replies View Related

Programming :: Struct Timeval Doesn't Keep After Function Returns

Jun 2, 2010

int GetTime(struct timeval tv)
gettimeofday(&tv, NULL)
", tv.tv_sec); /* here is the right value */
return 0;


What happend? struct timeval has a self timer?

View 3 Replies View Related

Programming :: Create A Global Struct Variable With Predefined Member Values?

May 26, 2010

Is it possible to create a global struct variable with predefined member values?Only one instance of that struct is ever needed.

View 1 Replies View Related

Programming :: SDL Static Library - Shared Library ?

Apr 7, 2009

I'm reading about shared, static, and dynamic libraries. What is SDL? Is it static, shared, or dynamic?

I always thought a library would be a lot of .h and .cpp files compiled separately into .o files and then if you compiled your own program you could use the -l parameter to link the library and it was all compiled together. Now I'm not so sure.

I don't even see any SDL .cpp files in my system anywhere. All I have are lots of SDL .h files in /usr/include/SDL and I don't really understand the code in them.

I'm making a wild guess here: SDL is a shared library. SDL itself is NOT compiled into my program, therefore SDL must be on any system my program tries to run on. When I compile and link SDL all it needs is the header files to know what SDL function and objects it can use. And then on every system it uses an already compiled SDL shared library thingy somewhere.

So... where is that part of SDL? All I can find are header files.

I'm thinking the advantage of shared libraries is that someone could say update SDL on their own system and take advantage of the new features without having to download new executables with the new version of SDL compiled into them for every program that uses SDL.

So if I'm making an editor and a game engine and they both use a lot of the same .cpp and .h files that I wrote and I'm tired of updating one and then the other and I need to turn them into a library, then a shared library might be kind of a silly solution. I could just make a static library. Right? Because it's not SDL. Nobody else is ever going to use this library.

View 6 Replies View Related

Programming :: Kernel API *get_super (struct Block_device *bdev) Producing Error With Fedora Core 5

Feb 2, 2011

I understand that block_device pointer *bd sholuld get initialized. Program should produce initialization error for *bd. Compiler is producing '->'. I am not understanding why?


View 1 Replies View Related

Programming :: Kernel Module - Task_struct / Files Struct, Open_fds, And The Open File Descriptors In Task?

May 1, 2010

This for Kernel I'm trying to code a kernel module that displays process information.

how to count opened file descriptors per task. I have been able to write a module that lists all the current process names along with their pid number in /var/log/messages. Basically, I cycle through the ring of processes using the macro for_each_process(task) and printk the comm and pid of each task. I'm trying to see how many file descriptors each task has open. I've been reading up in books and all over the internet. At first I thought I needed to access max_fds under files_struct, but that just lists the maximum number of file descriptors that can be opened per task, which by default is set at 256. I then thought about counting the elements in the fd_array. But then I learned that every task's fd_array is initially set at 32. Now I know that I need to access open_fds of type fd_set * in files_struct. open_fds is a pointer to all the open file descriptors. The problem is that I don't know how to access a pointer of type fd_set.

Is there a good guide or book that really focuses on type fd_set and open_fds? Every book and resource I've read never really go into depth on this. relationship between files struct, open_fds, and the open file descriptors in task?

View 4 Replies View Related

Programming :: Programming In C Using Ncurses?

May 2, 2010

I have a question, I was using ncurses in my program and made a user interface, that uses the menus. It is fine, but I wanted to execute another program when one item is selected. And after its exiting, I come back to the main one. I think that it can be done via window, but I wanted to separate them. Can you suggest me what to do? As I do it in Ubuntu Linux using fork & execl, that seems everything is mixed with the shell & if I don't do the closing of the objects, the keyboard & terminal attributes are the same as the one for the main, I used the system function, but not very different. I used atexit and when I use (probably) system (stdlib) function it calls the function registered with atexit. Please tell me the solution..

View 1 Replies View Related

Debian :: Reading From USB Keyboard Device?

May 1, 2010

I am running Debian off a CF on a SBC board (TS-7200). I am connecting via serial ttyAM0. It has a 2.4.26 Kernel running a Sarge distro of Debian.

I am using a terminal in windows to work on the device via serial. (Tera Term)

I am trying to read the input from a keyboard usb device. However, I want to eventually be able to read from any HID device. I currently have a Dell keyboard plugged into usb. lsusb gives:

Bus 001 Device 001: ID 0000:0000
Bus 001 Device 002: ID 413c:1003 Dell Computer Corp.
Bus 001 Device 003: ID 413c:2010 Dell Computer Corp.


View 1 Replies View Related

Programming :: Differences Of C And Pascal

Feb 22, 2010

I was wondering what are the main difference with these two languages? I mean besides just the syntax, only recently started looking at pascal. I find the syntax of Pascal nicer than C. So under the hood so to speak what are the differences? Also why do i see many look down at Pascal? Since C and C++ now are in more use than pascal, im guessing it offers something that Pascal and Object Pascal cant?

View 8 Replies View Related

Programming :: Convert A Dynamic Library ( To A Static Library (filename.a)?

Nov 18, 2009

How can we convert a dynamic library ( to a static library (filename.a) using gnu gcc . Can we get a static library form a dynamic library . I saw a few post in which the conversion form a static library to a dynamic library is mentioned but, unfortunately, not the other way.

View 4 Replies View Related

Programming :: BASH Shell Differences: Login Or Interactive

Feb 18, 2011

Intuitively I think that the Login Shell and the Interactive Shell are the same applications but have access to different environmental variables.It this true? Why is there more than one type of shell anyways? You can change users with the interactive shell, why not log on with it to?

View 10 Replies View Related

Copyrights 2005-15, All rights reserved