I have tried the above but keep on getting an error....
Thanks for the pointers anyway mate.
Type: Posts; User: it01y2
I have tried the above but keep on getting an error....
Thanks for the pointers anyway mate.
I have managed to realloc the elements in the array perfectly, however I am trying still to realloc the rows in the array, i keep on getting on getting a segmentation fault?
Running the code, I get this error, I think that reallocating is not working:
I have previously malloced the ammount of commands to 2, realloc should come into play and allow the extra commands to...
I have left out realloc as I am unsure how to use it correctly, I have looked at the man pages but cant implement it a 3d array effectively so it works.
I keep on getting various memory related...
My real problem is the realloc and mallocing issue, I am not sure what i am doing wrong, I have used various commands but keep on getting malloc/realloc errors.
Can i PM you my full code to test...
I am trying to split a string inputted into a 3d array, is soon as a new entry has been found when strtoking it then reallocing will come into play to compensate for the entry.
If it detects a '>'...
I am trying to work out how to detect a ctrl c, if the ctrl c is detected in the child the child of the parent will exit and return to the parent currently running a command line. I have tried to use...
I am compiling with the -ansi flag, i get the following errors:
p1.c: In function ‘main’:
p1.c:76: warning: assignment makes pointer from integer without a cast
p1.c:79: warning: assignment...
I managed to complete it, thanks to everyone who helped me :)
When I printf i get stacks of values, its crazy, identifying this error may take some time :(
I have tried to create the compare function but im doing something wrong:
int struct_cmp(const void *a, const void *b) /* Compare integer function */
{
struct pers *ia = (struct pers *)a;...
*shrug* I really dont understand this, how would you do it?
In the function im going to have to pass the struct by pointer into the compare function, then access the childs to do a comparison im guessing so?
KK i see, ty
qsort(q[j].person,400,sizeof(struct queue),struct_cmp);
I am not sure how to get the sizeof one element?
Thanks for the tips dude, really appreciate it. Its just implementing this now, I will give it a go.
This is my qsort function:
for(j=0; j < 22; j++)
{
qsort(p[j].person,p[j].number,sizeof(struct queue),struct_cmp);
}
Hi I am trying to qsort a struct, here is my code for my struct:
struct pers
{
char *name;
int age;
};
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <string.h>
#include "simpleio.h"
int main(int arc, char **argv, char **envp)...
I have looked around for the solution but cant get my code to work, can you help?
Im just wondering how i can pass multiple parameters in this instance:
Prompt the user to enter a program name and then input multiple parameters:
e.g:Program Name: ls, First Parameter: -l (and...