c

Can you recommend an interesting driver application that's fit for novice?

I'm totally new to driver development, seeking of an interesting driver related task to get started. ...

Can libnet be used to inject tcp packets/packet mangling?

I just took a glance at the introduction of libnet, seems it mentioned support for udp,*ip*,but not tcp? Does it support tcp at all? ...

msgsnd: Invalid argument

I receive msgsnd: Invalid argument error while using my program. Another thing i noted is that error do not occur if the file size is medium while it occurs when file size is slightly more. Is is due to memory overflow? If yes then what is the solution. Regards, Bhavin. ...

printf vs cout in C++

What is the difference between printf and cout in C++? ...

Seeking C Union clarity

typedef union { float flts[4]; struct { GLfloat r; GLfloat theta; GLfloat phi; GLfloat w; }; struct { GLfloat x; GLfloat y; GLfloat z; GLfloat w; }; } FltVector; Ok, so i think i get how to use this, (or, this is how i have seen it used) ie. FltVector ...

Can an Apache module inject configuration in runtime?

Hi, I wonder if it's possible for an Apache module to change global config structures. What I want to achieve is injecting new vhosts without Apache restart. Of course I'm aware that the changes would fully take effect after all workers have recycled, but for me - it's still better than a restart. I've written an Apache module before...

How to map a long integer number to a N-dimensional vector of smaller integers (and fast inverse)?

Given a N-dimensional vector of small integers is there any simple way to map it with one-to-one correspondence to a large integer number? Say, we have N=3 vector space. Can we represent a vector X=[(int16)x1,(int16)x2,(int16)x3] using an integer (int48)y? The obvious answer is "Yes, we can". But the question is: "What is the fastest wa...

How do you pronounce "->"?

Possible Duplicate: what is the official name of C++'s arrow (->) operator? I'm referring to the C operator which is used on pointers to mean the same think as the dot (".") would mean on the value. Incidentally, I'm most interested in how to pronounce it in perl as in $hello->world(). ...

Communication between parent and child

Hi every one ! I have a little problem. I have to code a simple C application that creat a process and his child (fork()) and I have to do an operation. Parent initialize the values and child calculate. I write this : #include <stdlib.h> #include <signal.h> #include <fcntl.h> #include <stdio.h> #include <unistd.h> typedef struct { ...

Is there a equivalent in C for C++ templates?

In the code I am writing I need a foo(int, char*) and a foo(int, int) functions. If I was coding this in C++ I would use templates. Is there any equivalent for C? Or should I use void pointers? How? Thanks. ...

How to overlay text or markers on an bmp image

Hi Guys, I'm working with an image processing project where I'm trying to locate features on a .bmp image. I'm writing the whole source code in C. The algorithm I'm developing is going to search for some features, if a desired feature was found by the algorithm then it is going to create a point (x co-ord, y co-ord), now I want to overl...

Simple c malloc question

this doesn't work: void funtion(char* var) { var = (char*) malloc (100); } int main() { char* str; function(str); strcpy(str, "some random string"); printf("%s\n", str); return 0; } this does: void funtion(char* var) { //var = (char*) malloc (100); } int main() { char* str; //function(str); ...

libiconv - iconv_open() default behavior?

According to the documentation of iconv_open() over: http://www.gnu.org/software/libiconv/documentation/libiconv/iconv_open.3.html "//TRANSLIT" means that when a character cannot be represented in the target character set, it can be approximated through one or several characters. and: "//IGNORE" means that characters that cannot be re...

Fast read of certain bytes of multiple files in C/C++

I've been searching in the web about this question and although there are many similar questions about read/write in C/C++, I haven't found about this specific task. I want to be able to read from multiple files (256x256 files) only sizeof(double) bytes located in a certain position of each file. Right now my solution is, for each file:...

Is it possible to embed C code in a C# project?

I know that it's possible to compile my C code into a dll, and then use P/Invoke to call that code. What I wondered if it was possible to have a chunk of C code embedded directly in my code, perhaps only available to one class... Something like this (non-working) example: public class MyClass { extern "C" { int do_somethin...

Which is faster: Appropriate data input or appropriate data structure?

I have a dataset whose columns look like this: Consumer ID | Product ID | Time Period | Product Score 1 | 1 | 1 | 2 2 | 1 | 2 | 3 and so on. As part of a program (written in C) I need to process the product scores given by all consumers for a particular product and time period...

How can I convert this C Calendaer Code into a Objective-C syntax and have it work with matrixes

#define TRUE 1 #define FALSE 0 int days_in_month[]={0,31,28,31,30,31,30,31,31,30,31,30,31}; char *months[]= { " ", "\n\n\nJanuary", "\n\n\nFebruary", "\n\n\nMarch", "\n\n\nApril", "\n\n\nMay", "\n\n\nJune", "\n\n\nJuly", "\n\n\nAugust", "\n\n\nSeptember", "\n\n\nOctober", "\n\n\nNovem...

Should this C pointer be released?

Please excuse my C newbiness. Consider the following C procedure: int doSomething() { char *numbers="123456"; ... } Before this procedure exits should I be releasing the 'numbers' pointer? ...

huge C file debugging problem

Hello all. I have a source file in my project, which has more than 65,536 code lines (112,444 to be exact). I'm using an "sqlite amalgamation", which comes in a single huge source file. I'm using MSVC 2005. The problems arrives during debugging. Everything compiles and links ok. But then when I'm trying to step into a function with the ...

How to efficently build an interpreter (lexer+parser) in C?

I'm trying to make a meta-language for writing markup code (such as xml and html) wich can be directly embedded into C/C++ code. Here is a simple sample written in this language, I call it WDI (Web Development Interface): /* * Simple wdi/html sample source code */ #include <mySite> string name = "myName"; string toCapital(strin...