Hello. I'm wondering if there's an easy way to iterate through a fd_set? The reason I want to do this is to not having to loop through all connected sockets, since select() alters these fd_sets to only include the ones I'm interested about. I also know that using an implementation of a type that is not meant to be directly accessed is ge...
I'm working with legacy embedded C code which defines the types uint8_t, uint16_t and uint32_t in a header file using the typedef keyword.
For discussion, let us say the file typedefs.h contains these definitions.
In my new C source module, I include stdint.h. I also include other header files which include typedefs.h somewhere in t...
Guys, got the answer in C ;
THank you for all the help .
Hey ,
I did go through the other threads on this(ADDREV Problem )(https://www.spoj.pl/problems/ADDREV/ ) but sadly, i am not able to get an answer by any of the three programs that i have written. ( in C , python and java ) . I am attaching the code snippets of all three. T...
Possible Duplicate:
Why does C++ support memberwise assignment of arrays within structs, but not generally?
Why is it that we can assign the object of one structure to other directly
eg:
struct student s1,s2;
s2=s1 //is perfectly ok.
but we can not assign one array value to the other
eg:
int a[10],b[10];
a=b //is not all...
I know that in C, for if statements and comparisons FALSE = 0 and anything else equals true.
Hence,
int j = 40
int k = !j
k == 0 // this is true
My question handles the opposite. What does !0 become? 1?
int l = 0
int m = !l
m == ? // what is m?
...
Follow up question to my pervious question:
http://stackoverflow.com/questions/3579860/conditional-wait-with-pthreads
I changed my code to use semaphores instead of mutex locks and conditional signals. However, I seem to have run in to a condition that I cannot explain.
Here is the abstract
function thread work {
while (true)
s...
I'm trying to debug a C/C++ native DLL project from Visual Studio 2010. I'm attempting to follow these instructions:
http://msdn.microsoft.com/en-us/library/c91k1xcf(v=VS.100).aspx
I want to use the built-in debugger and be able to step code, examine structures, etc. as I would do with a regular .exe project. The instructions on the pag...
I'm it really sure how to explain this question but i'll give it a try.
I have this line of code in my program:
scanf (" %c", &character);
Notice the space before %c. This is supposed to keep the scanf from interpreting the last ENTER key as a character. This works, however after this line and its resulting printf output the program w...
chdir can be used for constant character paths (it takes a const char *), but not for paths inputted by the user (since they have type char *). Is there any way around this?
...
I'm getting loads of errors like these:
gfx.h:48: error: syntax error before 'buffer'
gfx.h:48: warning: type defaults to 'int' in declaration of 'buffer'
gfx.h:48: warning: data definition has no type or storage class
gfx.h:73: error: syntax error before 'uint16_t'
gfx.h:73: warning: no semicolon at end of struct or union
gfx.h:74...
Suppose I want to completely take over the open() system call, maybe to wrap the actual syscall and perform some logging. One way to do this is to use LD_PRELOAD to load a (user-made) shared object library that takes over the open() entry point.
The user-made open() routine then obtain the pointer to the glibc function open() by dlsym()i...
Hello guys,
I am interested in Android kernel level programming. Actually I am a Linux kernel programmer. I would like to know how to start with the kernel and how compile, boot and about the Kernel level subsystems (EX: How file systems are implemented etc..) in Android. Any books or articles or a good guide to start are very much ap...
I have this SphereInFrustrum function here:
0.49% int FrustumG::sphereInFrustum(Vec3 &p, float radius) {
int result = INSIDE;
float distance;
2.40% for(int i=0; i < 6; i++) {
7.94% distance = pl[i].distance(p);
12.21% if (distance < -radius)
0.67% return OUTSIDE;
3.67% else if (distance < ...
The following code is producing a warning when I compile it on 32-bit systems:
1087: warning: integer constant is too large for "long" type; how can I fix this so I don't get that warning and it works correctly on 32-bit?
A valid input for this is:
unsigned char str[] = "\x00\x17\x7c\x3a\x67\x4e\xcb\x01";
and the mypow function retur...
Hello,
I am trying to make my program ignore ctrl-c in unix which seems to work, the issue is that it keep writing "Syntax error". Here is the code
extern "C" void ignore( int sig )
{
fprintf( stderr, "\n"); // Print a new line
// This function does nothing except ignore ctrl-c
}
int main()
{
// For ...
I have to compile a .c file that came with a matlab toolbox.
To this end I downloaded xcode 3.1.4, and now I am trying commands like
gcc -o solvemc solvemc.c
and getting errors like
Undefined symbols:
"_N_VFree", referenced from:
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX.o
_main in cca0ChgX....
I', using GL_FOG, but it really only fogs up my geometry, I would like a way for the fog to feel like it encumbers an area, not just fog up my geometry, sort of like a box of fog...
Is there a way to do this? Or possibly another way to give a smooth draw distance transition?
Thanks
...
Is there a way to make the msvc compiler as strict as gcc? MSVC lets me do some pretty crazy things that result in hundreds of errors when I compile in linux.
Thanks
...
how to compare two strings in C? Help me, I am beginner@@
char *str1 = "hello";
char *str2 = "world";
//compare str1 and str2 ?
...
Here is my issue. I'm rendering axis alligned cubes that are all the same size. I created an algorithm that rendered around the player like this:
******
******
***p**
******
******
While this does work, the player does not see this whole radius.
I know the player's rotation angle on the Y, so I was hoping to modify my algorithm based ...