Right now my application rotates on camera.rotationX, Y Z and does a -translation of camera.x,y,z on the modelview matrix. How could I equivocate this to a call to gluLookAt?
Thanks
basically how could I get this:
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
//starts here
glRotatef(Camera.rotx,1,0,0);
glRotatef(...
update, this question was based on this code http://jeffreystedfast.blogspot.com/2010/01/weird-bugs-due-to-gcc-44-and-strict.html
One trick question about C pointer.
Read code snippet below and try explain why the list value changed ?
tail has the memory address of list.
how is possible list be changed below ?
typedef struct _node ...
I'm using select() call to detect input presence in the main cycle of my program. This makes me use raw file descriptor (0) instead of stdin.
While working in this mode I've noticed that my software occasionally loses a chunk of input at the beginning. I suspect that stdin consumes some of it on the program start. Is there a way to prev...
I want to return a unique status code to a waiting parent process from a child process through exit(), based on the execution of child's code. If execvp fails, then the exit() is used. I assume that if execvp is successful, the command executed will send its status code.
pid=fork();
if(pid==0)
{
if(execvp(cmdName,cmdArgs)==-1)
{...
I am trying to implement EINVAL, EPERM, ESRCH in my program.
ERRORS EINVAL An invalid signal
was specified. EPERM The process
does not have permission to send the
signal to any of the target processes.
ESRCH The pid or process group does
not exist.
Here's my source code :
#include <stdio.h>
#include <sys/types.h>
#inc...
I'm having trouble with gdb and loading debugging information from shared libraries.
The error I get when running from within gdb is:
>>run
Error while mapping shared library sections: libhmmm.so: Success.
....
....
>>break container_main
Error cannot access memory at 0x9f18
The shared library in question exists and is located in the...
I need to write a sorting program in C and it would be nice if the file could be sorted in place to save disk space. The data is valuable, so I need to ensure that if the process is interrupted (ctrl-c) the file is not corrupted. I can guarantee the power cord on the machine will not be yanked.
Extra details: file is ~40GB, records are...
The following code uses getchar() to accept a line of input.
#include <stdio.h>
#include <stdlib.h>
int main()
{
char *rawString = (char *)malloc(200*sizeof(char));
char *rawStringInitial = rawString;
char c;
c=getchar();
while(c!='\n')
{
*rawString=c;
rawString++;
c=getchar();
}
*rawString='\0';
printf("\n[%s]\n",rawStr...
In the program below i initiliaze i to 255
Thus in Binary we have:
0000 0000 1111 1111
That is in Hex:
0x 0 0 f f
So according to Little-Endian layout:
The Lower Order Byte - 0xff is stored first.
#include<cstdio>
int main()
{
int i=0x00ff; //I know 0xff works. Just tried to make it understable
char *cptr=(char *)&i;
...
Could your recommend some good big integer calculation library in C/C++/Java and it is better to support logarithmetic.
Thanks.
...
I'm trying to return an integer value from a child process.
However, if I use exit(1) i get 256 as the output. exit(-1) gives 65280.
Is there a way I can get the actual int value that I send from the child process?
if(!(pid=fork()))
{
exit(1);
}
waitpid(pid,&status,0);
printf("%d",status);
Edit: Using exit(-1) (which is what I a...
This example works but I think that the memory leaks. Function used in the simple web server module and thus shared memory grows if you use this function.
char *str_replace ( const char *string, const char *substr, const char *replacement ){
char *tok = NULL;
char *newstr = NULL;
char *oldstr = NULL;
if ( su...
int val = 5;
printf("%d",++val++); //gives compilation error : '++' needs l-value
int *p = &val;
printf("%d",++*p++); //no error
Could someone explain these 2 cases? Thanks.
...
The title says it all actually.
In a simple way, i have an array of 10 values for example..and i would like to multiply each value with 5. Can i actually just do the following?
for (i = 0 ; i <10 ; i++)
{
x[i]=x[i]*5;
}
And what about getting square for values in the array and be stored back into the same array? As in I want x[...
I've got a Windows minidump (C code) and a corresponding exe file. Unfortunately, I don't have the exact matching .pdb files, but I do have .pdbs that contain the exact same code just built at a different time. In Windbg, I can use:
.symopt+0x40
To tell it to load anything, even mismatched symbol files. This works great in this partic...
I have a C function I want to use in Python:
extern int convertAtoB( stateStruct *myStruct,
const double PointA[3],
double PointB[3]);
Using SWIG, I think I need to define a typemap to convert the two points (PointA the input, PointB the output) so that Python can use it. There doesn't s...
I'm pretty sure i'm the one who's just dumb and don't know my data structures...
None the less, i'm going to post it here for you brilliant guys, so one of you may explain to me why this doesn't work:
#include <iostream>
using namespace std;
double data_convert(int n);
int main(void) {
cout << data_convert(sizeof(int));
}
double...
Hi SO,
I'm having trouble with dates management in C++ (VS 2008).
According to MSDN specifications, time_t represents:
The number of seconds since January 1, 1970, 0:00 UTC
therefore, I've written this piece of code:
#include <stdio.h>
#include <time.h>
time_t GetDate(int year, int month, int day, int hour, int min, int sec)
{
...
I have a parent process which forks out a child to perform execv().
I need the output given by execv() to stdout to be displayed onscreen as also copied to a log file.
How do I write the same output to both stdout & a file, without using pipes or tees?
...
This might be the most newbie question ever, but how do you compile a C program?
I’ve downloaded the source of a C program (ffmpeg, to be precise). How do I compile it?
...