I have a program which accepts 2 N-digit numbers, multiplies them using threads & prints the output.
The number of threads created here are 2 * N - 1.
whenever I run the program for N > 151, the program gives me a segmentation fault.
Is there a cap on maximum number of threads a process can get from the thread pool?
If so, could thi...
I have a joinable pthread runner function defined as below:
void *sumOfProducts(void *param)
{
...
pthread_exit(0);
}
This thread is supposed to join the main thread.
Whenever I ran my program through Valgrind I would get the following leaks:
LEAK SUMMARY:
definitely lost: 0 bytes in 0 blocks
indirectly lost: 0 bytes in 0 bloc...
While reading a book called "Let us C" I read that a function showbit() exists which can show you the bits of the number. There wasn't any special header file mentioned for it. Searched for it on the internet and didn't found anything useful. Is there such a function? I want this to print the binary of decimal numbers. Else please give m...
I'm trying to build up the proper data structure using a pseudo tcp header, tcp header, and tcp data to be sent to a check sum function to be verified. I cannot figure out what I'm doing wrong in my code.
The following code is my function that builds up the data structure and then sends it to another function to be checked.
void print_...
Hi.
I'm writing a proxy library (called Library A) that is just an interface to another DLL (called Library B) that may be present or not on the system.
The idea is that a program would link to this library A instead of the original library B ; and Library A would handle the errors if Library B wasn't installed on the system.
So a typi...
Hello guys!!
I can attach a file with libesmtp?
Does anyone have a sample code?
Thanks
FrankIT
...
If I write
#include <stdio.h>;
there no error but a warning comes out during compilation
pari.c:1:18: warning: extra tokens at end of #include directive
What is the reason ?
...
Possible Duplicate:
what is the difference between #include <filename> and #include filename
In both cases there is no error ...Is there any difference between them ?
...
If I write the following program, then there is no beep sound on running the code.
#include <stdio.h>
int main()
{
printf("\a");
return 0;
}
Can you tell me how to use \a for producing beep sound using C program ?
...
#include <stdio.h>
int main(void){
char x [] = "hello world.";
printf("%s \n", &x[0]);
return 0;
}
The above code prints out "hello world."
How would i print out just "h"? Shouldn't the access x[0] ensure this?
...
Hi,
In any programming environment,what ever the data type I am going to choose finally the CPU will do only the Arithmetic operations(addition/logical operations).
How this transition(from user defined data type/operations to CPU instruction set) happens and what is the role of compiler,interpreter,assembler and linker in this life cy...
I have written a code where in it would take in a executable file and the [lib*.so] library as my arguments and link @ Run-time.
I want to also take in the function in the (*.o) file @ run-time and link it.
But I don't know how to go about it.
EDIT 1:
The function I'm trying to link is a part of the .o file in the lib*.so library.
So I...
I am playing around with Cilk and I am having an issue with printing synchronously. Printing is slow, so it's hard to keep the prints synchronous. For example...
void ftn(int x)
{
if (x % 2 == 0)
{
std::cout << "printing.. " << x << std::endl;
}
else
{
cilk_spawn ftn(x/2);
cilk_spawn ftn(x++...
I read in many books that path for skbuff.h is usr/include/linux. I searched in Ubuntu, fedora and backtrack but can't find the header file. Can anybody help me to find this file? Thanks in advance.
...
So my code has in it the following:
unsigned short num=0;
num=*(cra+3);
printf("> char %u\n",num);
cra is a char*
The problem is that it is getting odd output, sometimes outputting numbers such as 65501 (clearly not within the range of a char). Any ideas?
Thanks in advance!
...
c:\users\yan\desktop\glossary_demo.h(2)
: error C2236: unexpected 'class'
'defined'
c:\users\yan\desktop\glossary_demo.h(2)
: error C2144: syntax error : missing
';' before type 'defined'
c:\users\yan\desktop\glossary_demo.h(2)
: error C2501: 'abstract' : missing
storage-class or type specifiers
c:\users\yan\desktop\...
I have the simplest code "Hello world"
#include <stdio.h> /* printf and BUFSIZ defined there */
#include <stdlib.h> /* exit defined there */
#include <mpi.h> /* all MPI-2 functions defined there */
int main(argc, argv)
int argc;
char *argv[];
{
int rank, size, length;
char name[BUFSIZ];
MPI_Init(&argc, &argv);
MPI_Comm...
I was wondering:
If I have structure definitions, for example, like this:
struct Base {
int foo;
};
struct Derived {
int foo; // int foo is common for both definitions
char *bar;
};
can I do something like this?
void foobar(void *ptr) {
((struct Base *)ptr)->foo = 1;
}
struct Derived s;
foobar(&s);
e. g. cast the void p...
Possible Duplicate:
Regular Expression in C
Does a regex.h exist which i can include?
...
I have some integers, let's say one two and three. I wish to create a string such as
char* example = "There are " + one + " bottles of water on " +
two + " shelves in room number " + three + "\n".`
This doesn't work in C/C++. How can I store that type of value in a char*?
...