Hey guys,
Say I use glRotate to translate the current view based on some arbitrary user input (i.e, if key left is pressed then rtri+=2.5f)
glRotatef(rtri,0.0f,1.0f,0.0f);
Then I draw the triangle in the rotated position:
glBegin(GL_TRIANGLES); // Drawing Using Triangles
glVertex3f( 0.0f, 1.0f, 0.0f); // Top
glVertex3f(-1....
Is it possible to disable all the I/O ports of the Windows PC my program is running on? If so, can that be done using C?
The goal is that the user should not be able to interact with the PC through any path except for the network card while my program is running.
...
Why bitwise operation (~0); prints -1 ? In binary , not 0 should be 1 . why ?
...
Hi
I am declaring following variables
unsigned long dstAddr;
unsigned long gateWay;
unsigned long mask;
These variables contains ipaddresses in network byte order. So when I am trying to print the dot notation using inet_ntoa function for mask variable sometimes it is printing strange values. The below code is in a while loop ....
Hi, I am planning to participate in development of a code written in C language for Monte Carlo analysis of complex problems. This codes allocates huge data arrays in memory to speed up its performance, therefore the author of the code has chosen C instead of C++ claiming that one can make faster and more reliable (concerning memory leak...
If there is the 'struct foo' and an APIs which handle foo,
which is more flexible and convenient API?
1) API only initialize foo. User should declare foo or allocate memory for foo.
The this style is like pthread_mutex_init/pthread_mutex_destroy.
example 1)
struct foo a;
init_foo(&a);'
example 2)
struct foo *a;
a = malloc(sizeof(st...
I want to modify the registry of window OS using c. kindly guide me or give me some hints so that I can make it possible.
...
Hello, I'm writing a FUSE plugin in C. I'm keeping track of data structures in the filesystem through structs like:
typedef struct {
block_number_t inode;
filename_t filename; //char[SOME_SIZE]
some_other_field_t other_field;
} fs_directory_table_item_t;
Obviously, I have to read (write) these structs from (to) disk at som...
Hi
We are currently developing an application for a msp430 MCU, and are running into some weird problems. We discovered that declaring arrays withing a scope after declaration of "normal" variables, sometimes causes what seems to be undefined behavior. Like this:
foo(int a, int *b);
int main(void)
{
int x = 2;
int arr[5];
...
I have allocated a chunk of memory of type char and size is say 10 MB (i.e mem_size = 10 ):
int mem_size = 10;
char *start_ptr;
if((start_ptr= malloc(mem_size*1024*1024*sizeof(char)))==NULL) {return -1;}
Now I want to store the size information in the header of the memory chunk.To make myself more clear, let's say: start_ptr = 0xaf86...
The C faqs explain it in a way, here is the link.
But I can't understand it, Somebody can explain it for me? Or give me another way?
Thanks so much!
...
I want to repeatedly zero a large 2d array in C. This is what I do at the moment:
for(j = 0; j < n; j++)
{
for(i = 0; i < n; i++)
{
array[i][j] = 0;
}
}
I've tried using memset:
memset(array, 0, sizeof(array))
But this only works for 1D arrays. When I printf the contents of the 2D array, the first row is zeroe...
hi all,
I wrote a small program which is as follows:
#include<stdio.h>
int c=0;
int main()
{
int a=10,b=20;
printf("Hello World\n");
c = a+b;
printf("%d\n",c);
return 0;
}
I can create a.out file using the command gcc -save-temps helloworld.c. The save-temps flag allows us to save the intermediate files, helloworl...
I wish to present the idea of MVC to a bunch of old C++ spaghetti coders (at my local computer club).
One of them that has alot of influence on the rest of the group seems to finally be getting the idea of encapsulation (largely due in part to this website).
I was hoping that I could also point him in the right direction by showing...
Some people are saying " static variable store its value in HEAP ", and others saying " static variable store store its value in DATA segment". I am totally confused with these conflict answers.
Where exactly static variable stores?. I am expecting an answer with standard reference ( text books, or good author tutorial).
Static variabl...
Hi all, I am working with a unit-testing suite that hijacks function calls and tests expected output values.
The normal layout requires one block of unit-testing code for each expected value.
Since my code makes use of a large number of enums, I would like to automate the automated-testing with some for loop / macro magic, and I'm look...
While implementing nedmalloc into my application, I am frequently hitting a situation when nedmalloc refuses to free a block of memory, claiming it did not allocate it.
I am using v1.06beta1_svn1151 version.
While debugging I have come up to the point I see a particular condition which is failing, all other (including magic numbers) su...
Hi, I am on a Mac, programming with Xcode. I have a command line application that will read/write to files in it's bundle and I was wondering how to access these files.
Thanks,
Mr. Man
EDIT: Would it work better if I just made a folder in the user's library folder?
...
Is there a way to automatically create p/invoke wrappers for .net from a c header?
Of course I could create them by hand, but maintaining them would be painful, and I'd probably make a mistake somewhere resulting in hard to debug crashes.
I tried SWIG, but it created full classes where simple structs would be sufficient.
Another proble...
By requirement, I'm targeting old legacy Windows systems (9x branch) where getaddrinfo() and freeaddrinfo() are not available.
What can I use instead of that? The code I'm using right now is extracted from the MSDN site (I'm testing it in a Vista computer):
...
/* WinSock data: */
WSADATA wsaData;
/* Initialize the WinSock data: */
sho...