Can a socket be closed from another thread when a send / recv on the same socket is going on?
Suppose one thread is in blocking recv call and another thread closes the same socket, will the thread in the recv call know this and come out safely?
I would like to know if the behavior will differ between different OS / Platforms. If yes, h...
Why exactly do we need a "Circular Linked List" (singly or doubly) data structure?
What problem does it solve that is evident with simple Linked Lists (singly or doubly)?
...
If I make a function that returns more than 1 values to the same variable like in the example:
char *strstr(char *s1,char *s2)
{
int flag=1;
char i,j;
for(i=0;*s1;i++)
{
if(s1[i]==s2[0])
for(j=i;*s2;j++)
{
if(s1[j]!=s2[j])
flag=0;
}
}
return i;
return 0;
}
What will be the actual value returned by the function?Wi...
hello i got a problem using valgrind
when i use it with valgrind --leak-check=full and afterwards the name of excution file it tells me in which blocks the memory leak is but when i cant find to which pointer i did use free.
is there some sort of flag that tells the name of the pointer.
if there is anyway to tell me where the leak is o...
#include<stdio.h>
int main()
{
int i=7,j;
j=(i++,++i,j*i);
return 0;
}
j=(i++,++i,j*i);Is this well defined ? Let me clear my doubt.
...
I need to do the following equation floor(e%100000) where e is a double. I know mod only accepts int values, how do I go about achieving this same result?
Thanks
...
Hi friends, this might be a bit long so my apologies.
consider the following code (i've left some irrelevant parts from it). this code receives a pointer to a struct (BoardP theBoard), x & y coords and a value.
the goal is to place the value in a 2D array that is found in the struct.
if the coords are out of bounds, i have to increase th...
What type of variable that can contain 1,000,000,000(a decimal number) takes the most memory space?
int in C
string in C
string in Java(which uses unicode)
...
#define int_p int*
int_p p1,p2,p3; // only p1 is a pointer !
can somebody exlplain why it is so.
...
I've an IR Receiver. There aren't drivers for Mac. I find this device in IORegistryExplorer, now i want read inputs from this device.
...
hello,
gcc 4.4.4 c89 Fedora 13
I am wondering what is better. To give you a compile of examples: apache runtime portable and log4c.
The apr version in my fedora repository is 1.3.9. The latest stable version on the apr website is 1.4.2.
Questions
Would it be better to download from the website and install, or install using yum...
I have a DLL containing a COM object that I'm trying to use.
I couldn't find any good explanations of how to do so with C.
It would be much appreciated if you guys could redirect me to a tutorial or something.
...
Please suggest me a more efficient alternative to go about this Program
#include <stdio.h>
int main(void)
{
int k, i, t;
int arr[100]; //Declaring an array
printf("Enter a positive integer: ");
scanf("%d", &k);
for (i = 0; i < k; i++)
{
//printf("enter a value %d : ", i);
scanf("%d", &arr[i]);
...
Over the summer, I started to learn CUDA C because the nVIDIA performance claims were simply unbelievable. This past week, I started another semester of my undergrad studies. My major is computer science.
One of the classes I am taking this semester is undergrad research and want to further practice with CUDA C. Does anyone have an...
Is there anything speaking against a structure like to following. In Release mode, Visual Studio seems to ignore i < 10 and execute the loop without end. If I set a break point I see that i runs from 0 to 9 and stays at 9 in all further iterations. If I printf i, I get a error after the 10 iteration, because arr only has 10 fields. Very ...
I am getting a weird problem while using scanf() to store data into a union.
Here's my code
#include <stdio.h>
union Student
{
float score;
char grade;
};
int main(void)
{
union Student jack;
printf("Enter student score : ");
scanf("%f", &jack.score);
printf("Score : %f", jack.score);
jack.score=0;
...
Hi,
I'm downloading 6kB of data from a test instrument connected via TCP socket. I'm using SOCK_STREAM:
if((MySocket=socket(PF_INET,SOCK_STREAM,0))==-1) exit(1);
I haven't set the any buffer sizes, so I assume I'm using whatever the default is. I'm having a problem with receiving data. Here's the statement:
if((recv(MySocket, &YRa...
I am a novice C coder who would like to write a role playing game resolution library. What I mean by this is that this program would only deal with resolving those conflicts which is piped into it. For example, when informed that Captain Amazing uses his Blasto eye beams at medium distance with his d8 Shooting Skill costing 3 Power Poi...
Is there any way to unstringify strings provided as macro arguments? I need to be able to call functions who's names are in strings. Something like this:
void hello() {
printf("Hello, world!");
}
call_func("hello");
How would I implement call_func. It would be in a module that would be #included and would be used to call functio...
Here's what I would like to do: When C-c C-l is pressed, a new terminal window is launched if there is no terminal window already, then, in that terminal, gcc is invoked with some flags and the current buffer's file. How would I do that?
...