c

Learning C from a background in C#

I want to broaden my programming experience and so figured that learning C (not C++) would be a nice idea - I've got a starting project (some simple 2D games using SDL) and given it a go, but I have to admit I'm struggling. Now I consider myself to be a very a competent C# developer, but C is just a completely different world! No name...

Cubic Spline class for Obj C or C?

I need to use natural cubic spline interpolation in an iPhone app. Does anyone know of a class for Obj C or C that resembles this: http://www.ee.ucl.ac.uk/~mflanaga/java/CubicSpline.html "performing an interpolation within a one dimensional array of data points, y = f(x), using a cubic spline." ...

Why do it is required to type cast a pointer?

Hi to C programming expert I am not an expert in C. I am trying to find answer for http://stackoverflow.com/questions/3993762/php-passing-c-struct-data-throught-socket-programming/3996282#3996282 Therefore I am starting a new thread to ask specifically on C language below is the data: typedef struct { UI2 todo; ch...

how to create this 'game' in quincy? need help...

i have done only loops,if/else,arrays and functions. And im expected to finish this assignment by 5th October 2010. Would be really grateful if anyone could help me with this!! Topic: Flip’em Background: Flip’em is a fun matching game that helps you improve your memory. Your goal is to match each tile with its twin until all the chara...

Apache module in C: how to write data to client socket?

Hello, I have created a simple mod_perl module, which writes a 0-terminated string to the Flash-clients connecting to the port 843. It works ok, but uses 20m per httpd-child at my CentOS 5 Linux machine. So I'm trying to rewrite my module in C, but I'm not sure how to access the client socket through the conn_rec struct that my protoco...

How to code first order logic formula in C?

Hello, I am newbie in C and new to stackoveflow too. I have some problems in coding first oder formula like forall([X],implies(X,f(X))) Here x is a variable, implies is predicate and f is function. It sounds like for all x, x implies function of x i'e f(x). using C. Any kind of suggestions and help will be appreciated. ...

What's the major difference between "union" and "struct" in C.?

Possible Duplicate: Difference between a Structure and a Union in C I could understand what a struct means. But, i am bit confused with the difference between union and struct. Union is like a share of memory. What exactly it means.? ...

How to code a modulo (%) operator in C/C++/Obj-C that handles negative numbers

One of my pet hates of C-derived languages (as a mathematician) is that (-1) % 8 // comes out as -1, and not 7 fmodf(-1,8) // fails similarly What's the best solution? C++ allows the possibility of templates and operator overloading, but both of these are murky waters for me. examples gratefully received. ...

mkfifo Alternative

Hi there, I have a process that continuously needs to write information. Furthermore, there is a second process which sometimes connects to the "information channel" of the writing process and should read the information that are written since it's connected. This process might also deconnect and reconnect several times again. I am cur...

Howto make a var. name with a var. in C/C++?

Hi, i have some vars live: int foo1; int foo2; .. and i want to reach them from: for (int i = 1;i<=2;i++) { // howto get foo1 and foo2? } how to get them? EDIT, end what when it will be no int but a Opject *pointer;? ...

Problem with hashing function - C

I am using the following hashing function provided in the K&R book. #define HASHSIZE 101 unsigned hash(char *s) { unsigned hashval; for (hashval = 0; *s != '\0'; s++) hashval = *s + 31 * hashval; return hashval % HASHSIZE; } In my project, I have more warnings turned on (warnings are treated as errors too) and the...

32 bit Windows and the 2GB file size limit (C with fseek and ftell)

I am attempting to port a small data analysis program from a 64 bit UNIX to a 32 bit Windows XP system (don't ask :)). But now I am having problems with the 2GB file size limit (long not being 64 bit on this platform). I have searched this website and others for possible sollutions but cannot find any that are directly translatable to m...

Finding #defined string length already at compile time

Hello, I have a C-program (an Apache module, i.e. the program runs often), which is going to write() a 0-terminated string over a socket, so I need to know its length. The string is #defined as: #define POLICY "<?xml version=\"1.0\"?>\n" \ "<!DOCTYPE cross-domain-policy SYSTEM\n" \ "\"http://www.adobe.com/xml/dtds/cross-domain-p...

How to enable large file support under Darwin?

I have a C application I am trying to compile for Mac OS X 10.6.4: $ uname -v Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 My gcc is as follows: $ gcc --version i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664) My Makefile is as follows: CC=gcc CFLAGS=-D_FILE_OFFSET_B...

chdir doesn't work in c

I have a father process and a child process, the second created with fork, the child receive from the father a char s[] (s can be something like "cd Music" ), i extract Music from "cd Music" using strtok, but when chdir(dir) executes i get "No such file or directory". But if i test chdir("Music") i get no error. I want to change the work...

Handwriting Recognition APIs?

Are there any good handwriting API's out there? A search gives a 1991 project by Sun HRE API. C/C++ APIs preferred! ...

Large numbers of TIME_WAIT socket connections running Redis

We're using Redis for monitoring on a high traffic web application. The app is written in c and uses the credis client library. We're seeing enormous numbers of TIME_WAIT connections left over from our communications with Redis: $ netstat -a | grep 6379 | grep TIME_WAIT | wc -l 15865 Any idea what's going on here? " rh = credis_...

Add characters to char array in structure

I am attempting to complete a homework assignment and would like to make an array of data structure and initialise it with names. However, when I try to compile my code I get the following error: **error C2440: '=' : cannot convert from 'const char [13]' to 'const char'** I am including my code below. Please advise me what I might be ...

Getting My Arse Kicked by a Segmentation Fault.

I am working on a uni assignment, which is to be done in C. This is my firs time programming in C, and I am VERY close to having a workable solution, but my code is throwing a Segmentation Fault during runtime and I simply cannot locate the cause. Here is my code: #include "./shared.h" #include "./scheduler.h" PCB_entry *ready_q...

Grayscale blending with OpenGL?

Is there a way to set the blending parameters so the whole scene renders in grayscale? (without using GLSL, only pipeline functions) Thanks ...