c

How to iterate a list box and issue commands to all the items

I want to create an auto-tunneler for Garena. What basically has to be done is iterate through all the items in the list box (in the right - I think that is what it is.), right click and click tunnel on each of them. I only have a C compiler with me atm. Any ideas on how to do this? What API calls and so on? EDIT: Few clarifications a...

What EXACTLY is meant by "de-referencing a NULL pointer"?

I ama complete novice to C, and during my university work I've come across comments in code that often refer to de-referencing a NULL pointer. I do have a background in C#, I've been getting by that this might be similar to a "NullReferenceException" that you get in .Net, but now I am having serious doubts. Can someone please explai...

Question regarding memory allocation of variables in a structure (In C).

Possible Duplicate: Why isn't sizeof for a struct equal to the sum of sizeof of each member? #include <stdio.h> int main(){ struct word1{ char a; int b; char c; }; struct word2{ char a; char b; int c; }; printf("%d\t%d\n", sizeof(int), sizeof(char)); //Output : 4 1 printf("%d\t%d\n", sizeof(struct word1), sizeof(st...

Why am I getting a "statement with no effect" warning?

The following is my code /* Initialise default without options input. */ options -> processHiddens = false; options -> timeResolution = DEFAULT_MOD_TIMES; options -> performSync = true; options -> recursive = false; options -> print = false; options -> updateStatus = true; options -> verbose = false; options -> programname = malloc(BUFS...

One large malloc versus multiple smaller reallocs

Hello. Sorry if this has been asked before, I haven't been able to find just what I am looking for. I am reading fields from a list and writing them to a block of memory. I could Walk the whole list, find the total needed size, do one malloc and THEN walk the list again and copy each field; Walk the whole list and realloc the block of...

Can I please get some feedback for this strcmp() function I implemented in C?

Hello. I'm learning C. I find I learn programming well when I try things and received feedback from established programmers in the language. I decided to write my own strcmp() function, just because I thought I could :) int strcompare(char *a, char *b) { while (*a == *b && *a != '\0') { a++; b++; } return ...

Assembly Language to C

Hi, so I have the following assembly language code which I need to convert into C. I am confused on a few lines of the code. I understand that this is a for loop. I have added my comments on each line. I think the for loop goes like this for (int i = 1; i > 0; i << what?) { //calculate result } What is the test condition? And ...

How to catch GTK focus state in gtkrc ?

GTK+ 2.x has the follow states: NORMAL, PRELIGHT, ACTIVE, INSENSITIVE, SELECTED for use in GTK themes and I can do things like... bg[NORMAL] = "#f6f6f6" .. to change background color when in NORMAL state. Also, I can change the background image of a button (when the mouse is over it) by changing the PRELIGHT state image. But I was n...

How can I add command line arguments when compiling and running a C program in Xcode?

When I work on C currently, I use Xcode and just press Build & Run in the Debugger Console which shows all the program's output. I want to test iterating through command line arguments now. I tried to fake it with... int main() { char *argv[] = {"echo","-n","hello world!"}; int argc = 3; } But trying to iterate through ...

A good line-graph generator for my benchmarking?

To learn more about a language I rewrite some of the core functions, or compare basic speeds of each set of functions per problem to see what is more suited in real world situations. Other than an ugly online line-graph generator which often only allows one or two series, I cannot find anything that would suit what I need. Do you know ...

C pointer on a pointer : unused variable

Hello, I was just doing my first app in C and i have this warning (edited) : unused variable pp int compteur = 1; int *p = &compteur; int **pp = &p; I was just trying to make pp pointing on the adress of the variable p Forgive me if that's a stupid question, but in my book they don't talk about pointers on pointer. Thanks ...

Please explain the output of this program

Possible Duplicate: Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc) I am using Visual C++ 6.0 and facing trouble predicting the output of the following program: int main(int argc,char **argv) { int a; int b; a=1; b = (++a) + (a++) + (a++); printf("%d",b); return 0; } ...

Tips on how to read last 'word' in a character array in C

Just looking to be pointed in the right direction: Have standard input to a C program, I've taken each line in at a time and storing in a char[]. Now that I have the char[], how do I take the last word (just assuming separated by a space) and then convert to lowercase? I've tried this but it just hangs the program: while (sscanf(line...

Can I have functors in C?

Can I have functors in C? I mean for example in C++ I can do: struct Rules { operator()(/*maybe some args*/) { } }; Some (fictitious) algorithm: int sort(iter beg, iter end, Rules); Can I do identically in C? ...

C - What is this syntax about? <<

what does this sybol means please? "<<" for example: if (1 << var) I want the name of the thing to study. Thank you. ...

memory allocation for array of pointers

I need to allocate memory for a pointer which needs to be used as a 2d array.I know how to allocate memory for char pointers and int pointers I am confused how memory is allocated of a array of pointers.A pictorial representation of the reason would be very helpful,also is the code below fine? char *names[5]; for(i=0;i<5;i++) { names[i...

What is correct way to have single Signal Handler function for multiple Signals?

What is the best way in C on Linux for setting up a program that can handle multiple POSIX-signals with the same function? For example in my code I have a handler function that I want to generically call when ever a signal is caught to perform some actions: /* Exit handler function called by sigaction */ void exitHandler( int sig, sigi...

Copying alhpanumeric chars in C

Hey, this should be pretty simple but getting stuck. Have a char array of text, want to store the alphanumeric lowercase value in a pointer array. ie mystr should point to a char[] of "50sometexthere" char[] myline = " 50 Some Text Here "; char *mystr = (char *)malloc(128 * sizeof(char)); char *tmp = myline; while (*tmp != '\0'){ i...

Getting list of files in a folder using C

Hi I have path to a folder for example /myfolder or in Windows: C:\myfolder and I want to get a list of all files in that folder. How shall I do so in C? Is it different in C++ or C99? How can I get a list of its folders? Any help is appreciated. ...

v4l2 very simple example

Hi, I'm looking for a simple example for camera access in Linux using V4L2. Where I can find it? As simple, as possible. Thanks, ...