Linux console keyboard handler
Is it possible to write a C program which works in XFCE's terminal until the user hits Esc-key? If yes, how? ...
Is it possible to write a C program which works in XFCE's terminal until the user hits Esc-key? If yes, how? ...
I'm wondering how to create a minimal virtual machine that'll be modeled after the Intel 16 bit system. This would be my first actual C project, most of my code is 100 lines or less, but I have the core fundamentals down, read K&R, and understand how things ought to work, so this pretty much is a test of wits. Could anyone guide me in ...
As title says, the meaning of both eludes me. ...
I have written a printf() statement like below: printf("hello\n"); this works fine when built using Linux' gcc compiler. However if I write printf("hello"); the print doesn't appear on the screen. There is some buffering mechanism it seems? Can anybody give me more information on this? ...
Hi, How portable is weak linking? #pragma weak my_symbol I see that question: ow-to-make-weak-linking-work-with-gcc discusses how to get it working. But is there a good way to do this such that gcc is not required? What is the difference between weak linking and guarding the declartion with an #ifdef? #ifndef my_weak_fn void my_w...
hello, I have a general question about popen (and all related functions), applicable to all operating systems, when I write a python script or some c code and run the resulting executable from the console (win or linux), i can immediately see the output from the process. However, if I run the same executable as a forked process with its ...
I'm maintaining a tool which can convert ELF32 relocatables to RDOFF2 format. For this process to work I need to pre-link the input files currently using the ld-script shown below: OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) FORCE_COMMON_ALLOCATION SECTIONS { .text : { /* collect .init / .f...
I've read a lot about how to add an icon to an application built with Visual Studio, but I have no idea how to do this with Eclipse Galileo / C / MinGW. Can anyone write a description, or give me a link ta a description ? ...
Should I write my own or is there a library function that already does that? I need this for a pidgin plugin, so if there is something in the pidgin/purple/gnome libraries, that would be ideal. But other sources are fine, too. ...
A while back I switched the way I handled c style errors. I found a lot of my code looked like this: int errorCode = 0; errorCode = doSomething(); if (errorCode == 0) { errorCode = doSomethingElse(); } ... if (errorCode == 0) { errorCode = doSomethingElseNew(); } But recently I've been writing it like this: int errorCode = ...
As an exercise, I'd like to write a macro which tells me if an integer variable is signed. This is what I have so far and I get the results I expect if I try this on a char variable with gcc -fsigned-char or -funsigned-char. #define ISVARSIGNED(V) (V = -1, (V < 0) ? 1 : 0) Is this portable? Is there a way to do this without destro...
Hello all, I have an application and I want to be able to check if (for instance) two instances of it used the same arguments on execution. To make it clearer: myapp 1 2 myapp 1 3 This isn't a Singleton design pattern problem as I can have more than one instance running. I though about checking the running processes, but it s...
I am using scanf() to get a set of ints from the user. But I would like the user to supply all 4 ints at once instead of 4 different promps. I know I can get one value by doing: scanf( "%i", &minx); But I would like the user to be able to do something like: Enter Four Ints: 123 234 345 456 Is it possible to do this? ...
I have written a program in c. However once the program is finished it stops (duh). Is there a simple script that allows me to let the user start the program over again? ...
Hi, what is this little application for? When using it without any options reduces the size of the executables, but how/what it does? ...
Hello everyone, I am trying to execute a program from a parent using execl. I do the normal pipe setup and fork. Here is the trick... I need my children (there can be an arbitrary number of children) to all communicate with the parent. Program "A" (parent) creates pipe forks and execl into "B" (child). In the main() function of prog...
Hi, can someone give me a hint on how a histogram's pseudo code would look like? ...
I ran the following code, but nothing came up on the console.... #include <stdio.h> #define MAXWORDLEN 10 int main(void) { int c; int inspace = 0; long lengtharr[MAXWORDLEN + 1]; int wordlen = 0; int firstletter = 1; long thisval = 0; long maxval = 0; int thisidx = 0; int done = 0; for(thisidx = 0; thisidx <= MAX...
I am trying to make a function in C that will print a string taken as a parameter. Is this even possible in C? I have something like this in my header file, but string is not a valid identifier. I understand there are no strings in C, but what's the string.h class for? #include <string.h> #ifndef _NEWMAIN_H #define _NEWMAIN_H #i...
Is one aware of a date parsing function for c. I am looking for something like: time = parse_time("9/10/2009"); printf("%d\n", time->date); time2 = parse_time("Monday September 10th 2009") time2 = parse_time("Monday September 10th 2009 12:30 AM") Thank you ...