c

SwapBuffers causes redraw

I'm making a Win32 application with OpenGL in the main window (not using GLUT). I have my drawing code in WM_PAINT right now when I call swapBuffers it must be invalidating itself because it is constantly rerendering and using lots of cpu resources. How can I make it only render when it honestly receives WM_PAINT like when using GDI? Th...

Help C++ifying this C style code.

Hey I'm used to developing in C and I would like to use C++ in a project. Can anyone give me an example of how I would translate this C-style code into C++ code. I know it should compile in a c++ complier but I'm talking using c++ techniques(I.e. classes, RAII) typedef struct Solution Solution; struct Solution { double x[30]; ...

"Single NSMutableArray" vs. "Multiple C-arrays" --Which is more Efficient/Practical?

Situation: I have a DAY structure. The DAY structure has three variables or attributes: a Date (NSString*), a Temperature (float), and a Rainfall (float). Problem: I will be iterating through an array of about 5000 DAY structures and graphing a portion of these onto the screen of the iPhone device using OpenGL. Question: As far as dra...

Unable to link to opengl libraries? DOS / MSVC

Is there something wrong with this link.exe command line? OpenGL32.lib and Glu32.lib are found at both of the LIBPATH directories. Is it possible the libraries are somehow incompatible? Is there a way to have the link.exe say that instead of unresolved external symbol? Googling shows that this error usually means the libraries are not fo...

taking input then containing in string

input as; (A%v),(c+e),-p#-d //include no white space i want to hold input as A[0]=A%v A[1]=c+e A[2]=-p#-d is it possible? how?` ...

How should I deal with sqlite errors?

I have a long running application written in a mix of C and C++ that stores data in sqlite. While I am confident that committed data will remain available (barring mechanical failure) and uncommitted data will not be, it's not clear to me what I can do with this sort of middle state. I do a large number of inserts in a transaction and ...

telephone application programming on Linux

I'm a Linux user looking to write a program which will pick up the phone, dial a number, play a recording and record what the person on the other end of the line says and save it to an audio file. I will want to use the modem that came with my computer if possible. What should I use to write this program? ...

difference between SDL and GLUT

Hi, I am learning the Opengl graphic programming at Eclipse. Can someone tell me the difference between GLUT application and SDL application, so that I can dig into either one of them? Tks. ...

warning:gets function is dangerous

When i use gets function,gcc gives me a warning: warning:the `gets' function is dangerous and should not be used. Why gets and puts function dangerous? ...

strtok program crashing.

Hi, the program for strtok given on http://www.opengroup.org/onlinepubs/000095399/functions/strtok.html crashes everytime.. #include <string.h> ... char *token; char *line = "LINE TO BE SEPARATED"; char *search = " "; /* Token will point to "LINE". */ token = strtok(line, search); /* Token will point to "TO". */ token = strtok(NULL,...

How to write a Compiler in C for C

Possible Duplicate: Learning to write a compiler I want to write a Compiler for C. This is a Project for my College i am doing as per my University. I am an intermediate programmer in C, with understanding of Data Structures. Now i know a Compiler has the following parts: 1. Lexer 2. Parser 3. Intermediate Code Generator 4. O...

fill a buffer successively

i intend to fill a char-pointer array successively in a for-loop. the content to fill in is a integer so i need to cast. but i didn't get the result i want to.. for (i=0;i<max0;i++){ sprintf(buf, "%d", content[i]); } sprintf replaces the hole buf, but i want to append. for (i=0;i<max0;i++){ buf[i]=(char) contint[i] } but th...

How do you use the C language to produce a ruby gem?

I would like to see some source code or maybe a link to some that gives at least a stub for writing ruby gems in the C languages (C++?? is that possible too?) Also, some of you may know that Facebook compiles some of their code natively as php extensions for better performance. Is anyone doing this in Rails? If so, what has been your ex...

Sequential searching with sorted linked lists

struct Record_node* Sequential_search(struct Record_node *List, int target) { struct Record_node *cur; cur = List->head ; if(cur == NULL || cur->key >= target) { return NULL; } while(cur->next != NULL) { if(cur->next->key >= target) { return cur; } cur = cur->next; } ...

Scrollbar moves back after WM_VSCROLL

I have a window with its own H and V scrolling. I'm handling the event like this: case WM_VSCROLL: SetScrollPos(hWnd, SB_VERT, (int)HIWORD(wParam), TRUE); break; all I want is for the position of the scroll bar to stay once I release my mouse but what it's doing is just going back to the top after. What am I doing wr...

how do i use strace to know about system calls in my C program

Hi all, I wanted to know how can i use strace function to trace system calls in my C program and also use it for debugging my code. regs adi ...

Third smallest number in matrices and its addition

Hi, How can i addition one + one matric (array data structure) and after it find the third smallest number in it in C language (not C++)? Thank you for the code. ...

Algorithm to find the factors of a given Number.. Shortest Method??

What could be the simplest and time efficient logic to find out the factors of a given Number. Is there any algorithm that exist, based on the same. Actually, my real problem is to find out the no. of factors that exist for a given Number.. So Any algorithm, please let me know on this.. Thanks. ...

Bit shift and pointer oddities in C, looking for explanations

Hi all, I discovered something odd that I can't explain. If someone here can see what or why this is happening I'd like to know. What I'm doing is taking an unsigned short containing 12 bits aligned high like this: 1111 1111 1111 0000 I then want to shif the bits so that each byte in the short hold 7bits with the MSB as a pad. The resu...

Solve equation from string to result in C

Hi, I would like to know if anyone has info or experience on how to do something which sounds simple but doesn't look like it when trying to program it. The idea is : give a string containing an equation, such as : "2*x = 10" for example (this is simple, but it could get very complex, such as sqrt(54)*35=x^2; and so on....) and the progr...