Hi,
Is there any way to perform POSIX shared synchronization objects cleanup especially on process crash? Locked POSIX semaphores unblock is most desired thing but automatically 'collected' queues / shared memory region would be nice too. Another thing to keep eye on is we can't in general use signal handlers because of SIGKILL which ca...
Can you use the arrow operator with an array of type struct. For example:
struct {
char *foo;
} fooArray[10];
fooArray[0]->foo = ...
...
Trying to change background/foreground color....Using Gtk+ and C.
GdkColor color;
gdk_color_parse( "#0080FF", &color );
gtk_widget_modify_fg( GTK_WIDGET(button), GTK_STATE_SELECTED, &color );
gtk_widget_modify_fg( GTK_WIDGET(button), GTK_STATE_NORMAL, &color );
I am using above functionality but it is not giving any results.
...
Is there a C library function that I can use to parse a piece of text and obtain values for argv and argc, as if the text had been passed to an application on the command line?
This doesn't have to work on Windows, just Linux - I also don't care about quoting of arguments.
...
I have an application which prints strings to a buffer using snprintf and vsnprintf. Currently, if it detects an overflow, it appends a > to the end of the string as a sign that the string was chopped and prints a warning to stderr. I'm trying to find a way to have it resume the string [from where it left off] in another buffer.
If this...
I am a beginner on Stack Overflow.
I am working on a Unix platform in C/C++.
Knowing basic programming in these regards how could I start with multithreading?
Multithreading seems to be very interesting and I want to grow my knowledge in this regard.
How could I get started with multithreading and what are the best techniques/books/ebo...
in mplab ide what is the size of data types (int,unsigned int,float ,unsignedfloat,char.....)
...
The following code is from TPM emulator from Mario Strasser. The spec says,
PCR := SHA1(PCR || data)
reads "concatenate the old value of PCR with the data, hash the concatenated string and store the hash in PCR". It's not PCR := PCR BITWISE-OR SHA1(data) nor PCR := SHA1(PCR BITWISE-OR data)
TPM_RESULT TPM_Extend(TPM_PCRINDEX pcrNum,...
I'll write a program for Interactive UNIX (http://en.wikipedia.org/wiki/INTERACTIVE%5FUNIX). But in a year it will be ported to Windows. I'll write it in ANSI C and/or SH-script. When it runs on Windows it will be run as a Windows service. How do I make it as easy as possible for me?
I want to change as little as possible when I port it...
I was wondering if there is a clean way of counting from 0 to 255 using an 8 bit datatype, something like:
for(uint8_t i(0);i<=255;++i)
{
....
}
This obviously will not work but it makes it clear you want to count from 0 to 255.
A working solution would be something like:
uint8_t i(0);
do
{
...
++i;
}
while(i > 0);
Bu...
An argument has been raised in my class regarding C and C#.
I stated that it's correct to say that C & C# are the same (meant: same by functionality, but not by concept).
Different by concept: C# meant to be easier to program with than C. C is more descriptive.
Same by functionality: Everything you make with C# - you can also make with...
In my (PowerBuilder) application, I'd like to be able to determine the graphicobject object which corresponds to a given window handle.
Simply iterating over the Control[] array and comparing the value returned by the Handle() function for each of the child controls doesn't work, since not all objects in my application are children of t...
I have a function in C which generates a number of hours from a rtc peripheral, which I then want to fill an array within a struct object. The array is set up to take 5 digits, but I need to prepend leading zeros to the number when it is less than 5 digits.
Could anyone advise on an easy way of achieving this?
...
I am currently using libproxy to get the proxy information (if any) on RedHat and Debian Linux. It doesn't work all that well, but it's the only way I know I can use to get the proxy information from my code.
I need to stop using the lib since in most cases it doesn't recognize the proxy.
Is there any way to acquire the proxy information...
Hi,
I would like to read a thin YAML file using a simple C program. I beleve the best way for this is to use the follow library: Pyyaml.org.
After reading the wiki page, I have try to use some examples here:
http://pyyaml.org/browser/libyaml/branches/stable/tests/
But for a noob like me, it is not very simple to understand.
If for exa...
PAE (Physical Address Extension) was introduced in CPUs back in 1994. This allows a 32-bit processor to access 64 GB of memory instead of 4 GB. Linux kernels offer support for this starting with 2.3.23. Assume I am booting one of these kernels, and want to write an application in C that will access more than 3 GB of memory (why 3 GB? ...
I am using SWIG to wrap a C interface in Ruby. Given two structs
typedef struct Vertex {
int color, discoverd, finished;
struct Vertex *next;
} Vertex;
typedef struct Graph {
struct Vertex *vertex;
} Graph;
how can I create a #each method which yields the current vertex, so that I can process it in Ruby. Currently my SWIG inte...
This works perfectly while not open a client. When open a client, I don't receive the KeyRelease event, any idea? is possible that X is sending first the event to the client?
const XEvent ev;
KeySym keysym;
do {
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev.xkey.keycode, 0);
if ((keysym == XK_Tab
}
...
We were given an assignment that involved taking information from a file and storing the data in an array. The data in the file is sorted as follows
New York 40 43 N 74 01 W
the first 20 characters are the name of the city followed by the latitude and longitude. latitude and longitude should be easy with a few
fscanf(i...
This is "how to parse a config file" question.
Basically i have a text file (/etc/myconfig) that has all kind of settings. I need to read that file and search for the string:
wants_return=yes
once I locate that string I need to parse it and return only whatever it is after the equal sign.
I've tried using a combinations of fgets and s...