c

Auto generate header files for a C source file in an IDE

I am trying to use Eclipse and NetBeans for programming in C (not C++). Is there a feature/plugin for them which automatically keeps the source and header files in sync? As in, when I implement a function in the source file, does it automatically insert the correct lines in the header file? I did look at solutions like lzz, but they ar...

what is the difference between function declaration and signature?

In C or C++ what is the difference between function declaration and function signature? I know something of function declaration but function signature is totally new to me. What is the point of having the concept of function signature? What are the two concepts used for actually? Thanks! ...

feeding a mouse driver alternate data in linux

Hey... I'm in way over my head and looking for a broader understanding of what it would take to feed alternate data into a mouse driver to control the pointer without moving the mouse. I have modified a driver (untested) to provide random data, but I need to be able to turn on/off the random mouse data and I don't think a simple scanf ...

Getting windows caption from process ID

Hi, I have a process ID, what I want to do is return the class. If it is the desired class then return the caption, how do I do that? C Visual Studio 2008, XP SP3 ...

debugging information cannot be found or does not match visual studio's

I copied an existing project and renamed the folder. Now I get this error when I try to compile the application debugging information cannot be found or does not match. No symbols loaded. Do you want to continue debugging ? If I click yes, it compiles and runs fine. But now I have to deal with that message. Just curious about what i...

string overflow detection in C

We are using DevPartners boundchecker for detecting memory leak issues. It is doing a wonderful job, though it does not find string overflows like the following char szTest [1] = ""; for (i = 0; i < 100; i ++) { strcat (szTest, "hi"); } Question-1: Is their any way, I can make BoundsChecker to detect this? Question-2: Is their ...

Some help with a Linked lIst

Okay I have updated my code quite a bit. I am getting a new problem, but it seems to be on a correct path. Now when I enter in the numbers it just continually spits out the first number I entered instead of moving to the next number. main.c #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <cType.h> #include "list.h"...

How to convert string to char in C

I'm writing a compiler in C and need to get the ASCII value of a character defined in a source code file. For normal letters this is simple but is there any way to convert the string "\n" to the ASCII number for '\n' in C (needs to work on all characters)? Cheers ...

Unsigned modulos: alternative approach?

I'm in a need to optimize this really tiny, but pesky function. unsigned umod(int a, unsigned b) { while(a < 0) a += b; return a % b; } Before you cry out "You don't need to optimize it", please keep in mind that this function is called 50% of the entire program lifetime, as it's being called 21495808 times for the sm...

Using C++ types in an ANTLR-generated C parser

I'm trying to use an ANTLR v3.2-generated parser in a C++ project using C as the output language. The generated parser can, in theory, be compiled as C++, but I'm having trouble dealing with C++ types inside parser actions. Here's a C++ header file defining a few types I'd like to use in the parser: /* expr.h */ enum Kind { PLUS, MI...

can declared functions be called without a body

Can you call a function that has no body but is declared in the header in your code?? Please read below for my situation. I am learning c++ so if my terminology is off then you know why. Any how, I am reading this book called "Advanced 2D Game Development" so if anyone's read the book then maybe they can help me out. In c++ he set 4 ext...

reading binary datafile and writing into decimal no file

exp data is generated by my mc scaler card as a binary file with first 511 bytes as header and then 24 bit data followed by four bit roi data. i am not a expert in programming. i do understand a little. I would like to convert this file into a file (without header) decimal nos with first col as channel no (1 to 8191) then the data (24 bi...

How do you detect if a text file is corrupt before the program crashes?

I'm writing a command line program in ANSI C to parse a Quake 2 map file to report how many entities and textures are being used. My development machine is MacBook. I'm testing on OS X Snow Leopard (32-bit), Windows XP (32-bit) and Vista (64-bit), and Ubuntu 9.10 (32-bit). I had a crashed bug on Vista where the program would hanged with...

Swapping bytes in C (endianness)

I'm trying to swap bytes for an assignment, and I thought this would be the way to do it. p points to the scalar object to be reversed size is the number of bytes of the object. void *ReverseEndian(void *p, size_t size) { char *head = (char *)&p; char *tail = head + size - 1; for (; tail > head; --tail, ++head) { ...

Any exit status without explicitly using return /exit

This actually bugging me from quite sometime now.The question is like this : How to set the the exit status of a program to any value without explicitly using return/exit in gcc/g++ ? Let us consider this piece of code : (Takes input from stdin and print it to the stdout until a zero input 0 is encountered) #include <stdio.h> int main(...

How can I send images to x264 one by one?

I've got an image generator written in C. Now I want to pass those images to x264 to encode them and write it to a file. Every 100th image should be a key frame in order to save the video to disk every 100th frame. The image generator calls onImageGenerated() after each image. I'd appreciate any pointers on how to set up x264 in this...

Objective c - anything like c?

Basically I want to try and develop a basic iPhone app. I have 2 - 3 years experience in Java, and am currently studying C now - have done pointers memory management, etc. but very briefly. Is Objective C going to deviate too much from the C that I have learnt so far, so it will be like learning a brand new language? Or should I be able...

Is there a way i can launch another program without having to do a fork()?

Hi, I have a main program written in C, i need it to launch another process in parallel, I used the function system("./server"); the problem is that this process contains a while(1) loop so it never return to the main application... Is there a way i can launch the program without having to do a fork()? thanks! ...

send data internet using C

Hello everyone, I need to send a signal via my remote PC to the Internet that let me know if this pc is connected. I could send a link with GET values to my page and then from that php page make a query to the database. How do I send this value through a C program that runs on this remote PC? thanks! (it's a windows pc) ...

Generate random numbers following a normal distribution in C/C++

Does anyone know how I could easily generate random numbers following a normal distribution in C/C++ ? http://www.mathworks.com/access/helpdesk/help/toolbox/stats/normrnd.html I don't want to use any of Boost. I know that Knuth talk about this at length but I don't have his books at hands right know. Thanks, ...