c

ShowWindow within WM_CREATE

The way I see it, one use of a Window Procedure's WM_CREATE message is to relieve the caller of the burden of executing static code at window initialization. My window is to execute some code in the WM_CREATE message, including the ShowWindow function. I also want the ShowWindow to behave properly according to the nCmdShow parameter in W...

Understanding opengl's (glut) resize

I'm reading the sample code for the bezier curve on the online version of opengl's tutorial. I'm curious about how is resize being handled in the example cause I figure I might use it on my own version of this program , I placed my questions on its comments: void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); ...

Compiler randomly throwing different errors

I'm getting different errors each time I compile my C project. There are 3 sets of them that randomly appear during the building process, and all of them are syntax error before 'foo' or syntax error before 'foo' token. They happen in different files and there are no obvious syntax errors there. I'm using Windows 7, Eclipse with ...

Writing C code in Visual C++ on VS2010

I appreciate the differences are negligible, but im doing some number crunching and so i want to use C. Ive just created a project in VS2010, chosen a C++ project and written some C. All executes fine, but is this being created and executed in the fast(er) C compiler or the C++ because its a C++ project? How can i specify that the code...

Array-strings sorted using qSort in C

the question is simple: there is some way that the ordered array that returns me the "qsort", is returned in reverse, ie I want to avoid the use of any auxiliary array to invest the resulting array using qsort. this is my code, which reads from standard input strings to be sorted, and uses a comparison function for sorting. #includ...

How do tabs work for text boxes?

I'm making a game gui api and I'm wondering how to implement tabs. I'm using freetype for text. When I try to render '\t' It looks like a square. I'm wondering how tabs are implemented because they are not a fixed width. Thanks ...

Creating multiple threads and invoking other exectuables in Cygwin through system()?

I am working on a project in Cygwin. In an attempt to create multiple threads in C, and each thread calls another executable through the command line using the system() function, it turns out things are not working properly. Specifically, the code I have is like this: #include <pthread.h> #include <stdio.h> #define NUM_THREADS 5 vo...

win32/C dialog box: "modern" look / style for a combo box

I want my dialog box (resource) in a Win32/C app to have a "modern" look/style, particularly its combo boxes. By "modern", I mean that a "drop list"-type combo box looks like a solid button, with just a small "arrow" icon on the side, as opposed to the "old" look: flat edit box with a separate arrow button. In the VS dialog editor, the c...

C - wanted to know max memory allocable size in a program

I am a newbee in C I wanted to know the max memory allowed by an application. So I wrote a little program like the following. I have a machine with 16GB total memory and 2GB is used and 14GB is free. I expected this program to stop around 14GB, but it runs forever. Want am I doing wrong here? #include <stdlib.h> #include <stdio.h> ...

Is "int i = x++, j = x++;" legal?

Pretty clear in the title, I think. I'm not entirely sure on this, and I can't find a good answer via the Googles (alas, I haven't committed to the fine art of standards-fu), so I ask: int i = x++, j = x++; Is this defined? I am quite sure that i = x++, j = x++; as a normal statement would be undefined behavior is the comma operator, ...

C assignment of int

Hi, When you see code like this in C, what's the order of assignment? int i = 0, var1, var2; I don't understand the syntax... ...

How to through NAT with PPPoE ?

I want to create a route server to proxy some clients(they may not in the same intranet) to access internet. I need to assign unique ip to the client and get the ip when packets response,so I can do some monitor task. i want to know if I use PPPoE server to deal with this case, how to through NAT ? thanks! ...

Seamless scrolling tilemaps

I'm working on a top-down rpg, and want to implement seamless scrolling maps. That is, as the player explores the world, there is no loading screen between maps and no "doors" to the next area. I have two ways to break down the world. At the top level, I have "zones" which is simply a collection of 9 "maps"(These zones are only represe...

Efficient way to tokenize a string - C

I am trying to tokenize a string. I have a table of available tokens ordered in the form of a trie. Each token knows it has children. A simple tokens table will look like, pattern value has_children -------- ------ -------- s s-val 1 stack stack-val 0 over over-val 1 overflow ov...

C: Error opening file from string name

Edited: how can i save the first string and then use the strcat func void *threads_sorting (void *arg) { struct args_sort *mydata; mydata = (struct args_sort *) arg; FILE *forig char *file_name; //file_name = (char*)malloc( sizeof(char) * 10 ); file_name = mydata->fname; printf ("File Name: %s\n", file_name); char *final_nam...

Problem with simple pipe communication in C

I have a problem with this exercise: Write a program in C that creates a child and between father and child, there will be two-way communication using pipes. His father would read a file (whose name will be given the user) and will send letters to the child. The child will count the number of words starting from with 'a'; if the number...

How to store complex data struts in Memcache

I have a data struts like this: category: subcategory: color:red name:pen Is there any better method to store if i want to load such data in memcache? or Is there any other better memory database? Thanks! ...

the point of c style naming conventions

One of the classes I'm taking in college is where we are doing a ton of programming in C. We are supposed to use 'C' style naming conventions in the assignments or get docked marks (eg a variable is named like int line_counter, a function clear_array() ) I find this convention really really annoying esp coming after a year of Java where ...

i++ = ++i iS THIS TRUE OR FALSE ? explain?

iS THIS TRUE OR FALSE ? explain? i++ = ++i ...

String Compare problems? C

Ok so im having a bit of an issue here. basically Im reading shared memory but thats not the problem. I have a change.c function that lets me change a struct studentdata shared memory if I enter their "ID" number. ISSUE WAS SOLVED ...