I am trying to understand how the linux syscall sched_setaffinity() works. This is a follow-on from my question here.
I have this guide, which explains how to use the syscall and has a pretty neat (working!) example.
So I downloaded the Linux 2.6.27.19 kernel sources.
I did a 'grep' for lines containing that syscall, and I got 91 res...
I have run into some code and was wondering what the original developer was up to. Per the norm I have simplified it down to the basic case before asking your assistance. The man page for scanf has relevant information. I am having some trouble reading it.
#include <stdio.h>
int main() {
char title[80] = ...
I have a bit of code I'm running to test multithreading in MATLAB mex functions (I know MATLAB isn't thread safe... I'm just playing around to see what happens). The entry point to MATLAB C code functions has the signature of the mexFunction function in the code snipped at the bottom of the post. Since I want to essentially pass the ar...
How do you add a 'keyword' to the GEdit list of keywords? I basiclly want to make the printf function look like a keyword.
printf("Hello World\n");
...
I'm looking to make my CGI forum software FastCGI compatible.
The forum software consists of a few dlls and .exe (.cgi) files written in C and x86 assembly language. I also have a SQlite3 database.
Lighttpd runs all these cgi scripts as child processes and I much say that the whole thing works pretty damn well.
But I want to experiment...
I get the following errors when trying to compile the below code using g++. When I compile it using gcc it works fine (other than a few warnings). Any help appreciated.
g++ ush7.cpp
ush7.cpp: In function ‘int signalsetup(sigaction*, sigset_t*, void (*)(int))’:
ush7.cpp:93: error: expected unqualified-id before ‘catch’
ush7.cpp:95: err...
My Googling results in a huge amount of unnecessary results with C. My hope is to get the best C manuals local. I find the reference useful here. I would like to make my own notes and removal to the manual.
Can I manage it somehow like a local manual?
Feedback to the repliers worried about the law
Please, read this post about so...
So, I have some code, kind of like the following, to add a struct to a list of structs:
void barPush(BarList * list,Bar * bar)
{
// if there is no move to add, then we are done
if (bar == NULL) return;//EMPTY_LIST;
// allocate space for the new node
BarList * newNode = malloc(sizeof(BarList));
// assign the right v...
I'm following the directions on the Using Check with the Autotools page in an attempt to build in support for unit test in a (currently) small C project. Although I am using Cgreen instead of Check.
I'm having trouble with step 9, which is causing automake to emit a warning about the use of `%'-style pattern rules being a GNU make exten...
Hey everyone,
I have a set of 6 bits that represent a 7bit ASCII character. How can I get the correct 7bit ASCII code out of the 6 bits I have? Just append a zero and do an bitwise OR?
Thanks for your help.
Lennart
...
I have a small code block that should append text to the beg of a file. However it still only adds to the end of the file. I thought the rewind set the pointer to the front of the file, thus when I added the text using fprintf it should add to the front. How can I change this?
fp = fopen("Data.txt", "a");
rewind(fp);
fprintf(fp, "%s\n",...
I really want to learn C (I'm planning on joining an open source GNOME project). What would be a good tutorial?
...
I've done this function in C using system calls (open, read and write) to simulate the "cat" function in Linux systems and it's slower than the real one...
I'm using the same buffer size as the real "cat" and using "strace" I think it's making the same amount of system calls. But the output from my "cat" is a little bit slower than the ...
Hi Everyone,
I'm trying to debug a problem with a perl application that calls some c programs to do text editing.
BATCH_JV_CSH_MAX is used to test the maximum value of an amount field. It currently indicates an error if the amount is over 99,999,999.99. Is is supposed to accept values up to 999,999,999.99. Well, that is what is stat...
I want to add some Java (actually Clojure) based event handlers to a HUGE legacy C application.
What is the most straight forward and easily maintained way to do this? I would like the Java classes to be running in the same process as the C code. Is this even possible?
...
I need to create an application "dll, script or exe" which when the user upload on a folder on his server using his ftp, it will automatically run on the current folder and do some image manipulations in the folder images,
My Question is how to make something like this, which the user will not need to configure anything on his server, a...
I have used this summary reference for years but it is beginning to show its age. If you have any you might suggest as more current I would greatly appreciate it.
...
I want to make my GTK+ applications use the new notification area in Ubuntu. How can I do this? An example is shown below:
...
I'm writing my first major C API, and I want to get things right. The library allocates and frees memory for an internal struct - which is hidden from the client using a typedef. The rough structure of the data I'm providing access to is this:
disc->program->track
Associated with the disc are things like file descriptor to read from, s...
I'm looking for a good parser generator that I can use to read a custom text-file format in our large commercial app. Currently this particular file format is read with a handmade recursive parser but the format has grown and complexified to the point where that approach has become unmanageable.
It seems like the ultimate solution would...