c

How can I get Eclipse to index code inside #ifdef .... #endif

I'm using eclipse to work on some c code and it is not indexing code inside conditional compilation blocks like this: #ifdef USE_FEATURE_A int feature_a(...) { some = code(here); } #endif How can I get eclipse to index the feature_a function? ...

In which case if(a=b) is a good idea?

Possible Duplicate: Inadvertent use of = instead of == C++ Compilers let your know via warnings that you wrote if( a = b ) { //... and that it might be a mistake, that you certainly wanted to write if( a == b ) { //... But is there a case where the warning should be ignored because it's a good way to use this "feature"?...

Using volatile long as an atomic

If I have something like this... volatile long something_global = 0; long some_public_func() { return something_global++; } Would it be reasonable to expect this code to not break (race condition) when accessed with multiple threads? If it's not standard, could it still be done as a reasonable assumption about modern compilers? ...

What do you call a single header whose purpose is to include other header files?

I've seen this done before in various C++ libraries - namely Qt (QtCore, QtGui, etc.) and Irrlicht (irrlicht.h): // file - mylibrary.h #include "someclass1.h" #include "someclass2.h" #include "someclass3.h" // and so on... Obviously this exists for convenience - a programmer wishing to use the library only has to include one header i...

Explicit Intermediate Object Files in GNU AutoMake

I have a C application I'm converting from a set of hand coded Makefiles to GNU AutoMake. It has a subdirectory that contains an interface header and several platform-dependent implementations. Currently an implementation is selected and built to an object file with a fixed name in that directory. The code that uses the driver interface ...

Radio style instead of MF_CHECKED for menu item?

I noticed some applications have a blue circular instead of a checkmark which MF_CHECKED produces. Which style produces this circular one? Thanks ...

Communication between two application in the same local machine.

Hi, I am using C language and Linux as my programming platform. I am developing a user-space application that runs in a background, like a daemon. And my problem is, I want another user-space application to communicate with this daemon. I know that I have to use Interprocess Communication method but I don't know what is the correct i...

Initialize the structure of other structure

Hello, Can i initialize structure if other structure? For example: I have structure: typedef struct _JobParam { MainWin* mw; }JobParam; Where MainWin structure too. In main code i have function: Can the so-initialize structure or it's wrong way? void load (MainWin* mw) { Param param; param.mw = mw; } Thank you ...

C/C++ equivalent to java Integer.toHexString

C/C++ equivalent to java Integer.toHexString. Porting some code from java to C/C++, does C have a build in function to Integer.toHexString in java? UPDATE: Heres is the exact code i'm trying to port: String downsize = Integer.toHexString(decimal); ...

what higher-level language is most like c?

I've been learning C: it's a beautiful, well-thought-out language. However, it is so low-level that writing any sort of major project becomes tedious. What higher-level language has the most C-like syntax—but without all the clutter that you find in something like C++. Does one exist? ...

How do I fit a variable sized char array in a struct?

I don't understand how the reallocation of memory for a struct allows me to insert a larger char array into my struct. Struct definition: typedef struct props { char northTexture[1]; char southTexture[1]; char eastTexture[1]; char westTexture[1]; char floorTexture[1]; char ceilingTexture[1]; } PROPDATA; exampl...

how randomly select the word from 26 letters using C language?

I want codes for randomly selects the word (meaningful or meaningless) from 26 letters. The word contain 6 letters. I have the codes for C program or objective C, or you will give any idea to me. ...

C Programming error

I am working out a small program... wherein i provide the command line argments ` For e.g. ./a.out 2 3 4 + * when it comes ' * ', rather than printing the ' * ' itself, it prints the folders inside the directory,,, ' + ' works fine..... Please let me know how to remove this error..... I want to print ' * ' here........ #include <s...

function for getting a random number

I have tried to write a random number generators int generate_random_number(int min , int max )/*min and max describe the range*/ { /* assume range is 1-4 min=1 max=4*/ create an array b[max] and fill with 1,2,3,4; shuffle the array b /*shuffle is an another function*/ /* shuffle uses Fısher and yates' modern meth...

can we write that function in c form

When I read some question to write random nuber generator ,I saw that function and it efficient but it is written in C#. I want see that function in form of c language,can anyone help? IEnumerable<int> ForLargeQuantityAndRange(int quantity, int range) { for (int n = 0; n < quantity; n++) { int r = Random(range); ...

Possible to add another enum item to an existing enum type

Hi all! I wonder, whether it is possible to add/append another item to an existing enum type (part of a framework)? Something like this: We have the enum type typedef enum { UIModalTransitionStyleCoverVertical = 0, UIModalTransitionStyleFlipHorizontal, UIModalTransitionStyleCrossDissolve, UIModalTransitionStylePa...

Taking a screenshot with C\GTK

I'm trying to take a screenshot of the entire screen with C and GTK. I don't want to make a call to an external application for speed reasons. I've found Python code for this (http://stackoverflow.com/questions/69645/take-a-screenshot-via-a-python-script-linux/782768#782768); I just need to figure out how to do that in C. ...

How can we find the i'th greatest element of the array????

Algorithm for Finding nth smallest/largest element in an array using data strucuture self balancing binary search tree.. Read the post: http://stackoverflow.com/questions/2329171/find-kth-smallest-element-in-a-binary-search-tree-in-optimum-way/2329236#2329236. But the correct answer is not clear, as i am not able to figure out the corre...

suggesting algorithm book

Possible Duplicate: What is the best book for learning about Algorithms? Can you suggest me a book which include all of algorithms (about computer science). I want to buy or download algorithm book for studying. ...

Tool to identify the similarities in logic between a function of C and C++

Is there a tool in either Linux/Windows that would enable us to determine if a logic of the particular function in C is same as that of a particular function in C++ ? ...