c

How do I use OpenGL 3.x VBOs to render a dynamic world?

Although there seem to be very few up to date references for OpenGL 3.x itself, the actual low level manipulation of OpenGL is relatively straight forward. However I am having serious trouble trying to even conceptualise how one would manipulate VBOs in order to render a dynamic world. Obviously the immediate mode ways of old are non ap...

What's the kind of job that c/java can do but PHP will be hard to do?

Here,job is something like a complete utility. I need to know this to start the c/java journey! ...

C Puzzle - play with types

Please check the below program. #include <stdio.h> struct st { int a ; } fn () { struct st obj ; obj.a = 10 ; return obj ; } int main() { struct st obj = fn() ; printf ("%d", obj.a) ; } Following are the questions What is the output of the program? Where is ';' terminating the declaration of 'struct st'? By ISO IE...

C: deep copying - structure with a void pointer

Hi, I've got a following struct struct teststruct { int *a; void *data; }; Is it possible to do a deep copy of structure which contains a void pointer? I assume that I cannot tell how many bytes data pointer points to? So I cannot malloc specified number of bytes and do memcpy. Am I right? ...

flex, defining char

Hello I want to define char (ie 'a AND 'a') but I am having issues in checking errors. Here how I write the rule and check: char " ' " {letter} code {char} { int x =input() ; //printf("%d",'a'); if(x == 10) { return(tCharunterm); } ...

I want to start reading the Python source code. Where should I start.

I want to start reading the Python source code. My experience, I know Python and Java very well. I know some other languages at various levels of proficiency, but neither C/C+/ particularly well. I studied C in college, but have never professionally programmed in it. My Reasons for reading this code. Understand how python works unde...

Does Qt have a C interface?

I've found conflicting answers on the web - some say it does, some say it doesn't. I was unable to find any details in the official Qt documentation either. So does Qt have C bindings or not? ...

Extract statically linked libraries from an executable

I'm not sure if this is even possible, but given an executable file (foo.exe), with has many libraries which has been linked statically. Is there any software that extract from this file the .lib ( or .a ) that lay inside the executable ? Thanks. ...

Good C code to read for learning

To learning a language it is recommended to read some good code written in it. I want to recommend to friend some good C code to read. What projects are suitable online for reading good code? Criteria: Written in good style Well documented (both externally and internally if possible) Real-world, not tutorial-level or introductory book...

Two-dimensional arrangement practice

First, sorry for my poor language. I'm using VC++ Express myself. Now I'm studying about arrangements. The book gave me a project like so: Make a 5x5 matrix. Each column is for subjects (4 of them) Each row is for students (same, 4 of them) Each cell saves a score. At the end of each row/column, sum the row/column. And this is my ...

How to debug driver load error?

I've made a driver for Windows, compiled it and tried to start it via SC manager, but I get the system error from the SC manager API: ERROR_PROC_NOT_FOUND The specified procedure could not be found. Is there a way to get more information about why exactly the driver fails to start? WinDbg or something? If I comment out all code in my ...

GCC - shouldn't a warning be issued?

I've recently set up a MinGW + MSYS environment on my laptop to check how things are with Netbeans C/C++ support. Everything seems to work fine, however, during my testing I have noticed a difference between GCC and Microsoft's cl.exe compiler. Here's a sample program: #include <stdio.h> #include <stdlib.h> #include <limits.h> int mai...

Determine VRAM size on windows

I need to determine roughly how much VRAM a system's graphics card has. I know all the reasons why I shouldn't but I do. It doesn't need to be perfect (some cards lie etc.) but I need a ballpark. On mac it's fairly easy through core graphics and IOKit to just politely ask how much VRAM is attached to a display, but I haven't a clue on wi...

Optimizing a LAN server for a game.

I'm the network programmer on a school game project. We want to have up to 16 players at once on a LAN. I am using the Server-Client model and am creating a new thread per client that joins. However, a lot of CPU time is wasted just checking on each thread if the non-blocking port has received anything from the client. I've been read...

Having many stacks with different types

I'm making a C program that needs to use two stacks. One needs to hold chars, the other needs to hold doubles. I have two structs, node and stack: struct node { double value; struct node *next; struct node *prev; }; struct stack { struct node *last; struct node *curr; }; The problem is that I need one of each type...

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do this like so: int main() { char* str = "Hej du kalleåäö"; printf("length of str: %d", strlen(str)); for (int i = 0; i < strlen(...

linking mess with libc

I have a library compiled into a .a file, linked against my application. (iphone, developing with Xcode) Everything seems to be fine, linking seems to succeed, but when I run the program it crashes. The point of crash is at a memcmp() call in the statically linked library. The debugger shows all kind of stuff called with "dyld" in their...

Segmentation fault on time(0);

Hi! I'm rewriting an old program to do some new stuff, and suddenly I get a segmentation fault error on the following line of code: time_t seconds_since_time_begun = time(0); Why, oh why? Update: I have included the time.h header file in my code, and when I tried what pmg suggested below, both variables were 4 in size. When I tried...

passing a pointer to a structure as an argument to a thread cancellation cleanup handler

I'm having trouble passing a pointer to a structure as an argument to a thread cancellation cleanup handler. Here's some sample code that blows up when it hits the compiler. Any idea what I'm doing wrong? #include <pthread.h> typedef struct struct_def { /* data */ } struct_def; struct_def *ptr_to_struct_def; void * thread_functi...

P2P or Distributed System implementation

Hi, I have the work of implementing a distributed system of nodes (like p2p nodes) each of these nodes (lets say A,B,C and D) perform certain functions and need to interact with each other for various operations such as synchronize operations and other things like 15 A nodes interact with a group of 5 B nodes to get into the least loade...