Update: I run the program once and it runs just fine. The second time it loops around, it goes into the init() function but it doesn't generate the threads at all, then it exits as if everything...
Type: Posts; User: justgotthis
Update: I run the program once and it runs just fine. The second time it loops around, it goes into the init() function but it doesn't generate the threads at all, then it exits as if everything...
Forgot to post the header files....however, I know that I have no issues with these. The header files work just fine. It is when I try to loop my programin the main while loop that the threads don't...
the sorting works, the output functions I removed, I will not output doubles, and yes my sorting does work without cluttering everything. I removed the double thread creations in the if statement as...
Anyone??? You don't even have to look at the entire code, I just need to know if it is possible ot create multiple threads in a while loop. I enter the while loop, create the threads which they...
The complete code is attached. When I free the memory, after one loop, everything starts all over again and initialize all the objects again. The first param in pthread_create is the id of the thread...
I created threads just fine. However, when I try to loop the main program and execute the threads and the functions anew all over again, the thread creation does not complete. It is weird because I...
In my code snippet, I tried to seed the time so I can get random numbers everytime I run the program. I need to generate a random number from 0 to 1, but everytime I try to, I get a negative/positive...
I am trying to generate random numbers using drand48. I know, there are other random generators out there, but I need to use drand48. The code snippet is as follows:
double seedrandUI()
{...
From the same code, I compile the program and it gives me the error message:
"semget IPC_CREAT: No space left on device". This is weird because I have more than enough space on my drive. What is the...
well i just changed the int * from originally int in the Init function because I was getting "invalid argument" when the init function gets called. I still get these messages without the pointer in...
I defined each by using #define. I have included my main file in the attachment.
I am trying to implement semaphores. The include file is as follows:
#include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#define SEM_MODE 0666
sorry about that. out is the file descriptor and arr is the array ptr being passed in.
void theoutput(int* arr,int out)
{
int x;
char convert[50]; //buffer to hold int
for(x = 0; x <...
Hello, is there a way in C to convert an int to a char* (a string). I have done the following:
sprintf(charptr,"%d",intvalue);
But, when I run the program, an "H" appends to numbers that are...