Search:

Type: Posts; User: Sergi

Search: Search took 0.00 seconds.

  1. Parent process forking new child processes recursively

    Hi, I've created the below code:


    int main(int argc, char *argv[])
    {
    int n;
    pid_t pid;
    int status;

    pid = fork();
  2. Replies
    2
    Views
    13,540

    Thanks for the reply Salem, that was helpful.

    Thanks for the reply Salem, that was helpful.
  3. Replies
    2
    Views
    13,540

    strcpy not overwriting (segmentation fault)

    Hi, I'm trying to understand why I can't overwrite with strcpy on this piece of code:


    int main (int argc, char *argv[])
    {
    char *str2;
    char *str = malloc(sizeof(char)*10000);

    str2 = "...
  4. Replies
    4
    Views
    5,779

    Thanks Salem

    Thanks Salem
  5. Replies
    4
    Views
    5,779

    Those pieces of code are part of an assignment. I...

    Those pieces of code are part of an assignment. I need to work on them later on to optimize them in different ways, however at this point I'd like to understand why the second one takes much longer...
  6. Replies
    4
    Views
    5,779

    Running time difference

    Hi, I have two programs that perform the same task:


    #define N 100000000

    int main()
    {
    long int x;
    double sum=0;
    char str[100];
  7. Will look into that, thanks for your help.

    Will look into that, thanks for your help.
  8. My question is, what status is returned when the...

    My question is, what status is returned when the UX command the child is executing doesn't exist or can't be executed because it's a wrong path?

    I'm asking because I'm using WIFEXITED(status) and...
  9. Child process status when command doesn't exist/path iis worng

    Hi, I have this program which gets two arguments as parameters and runs it in linux:





    int main(int argc, char *argv[])
    {

    int status;
  10. thanks Salem, it works fine now. I've found that...

    thanks Salem, it works fine now. I've found that nomenclature in many tutorials. Again, thanks for correcting that one.
  11. Thanks Salem. The issue is, I'm already assigning...

    Thanks Salem. The issue is, I'm already assigning the space with this line in my original code:


    fact_table[i].str_fact = (char *)malloc(log10(fact_table[i].lli_fact));




    I've tried...
  12. Allocating dynamic memory to a string within a structure

    Hi, I have the below code:


    struct fact_entry
    {
    int n;
    long long int lli_fact;
    char *str_fact;
    };
  13. Replies
    1
    Views
    2,288

    Launch a fork every N seconds

    Hi everyone, I have this assignment in which I need to run "ls" every N seconds. We're not allowed to use signals, we can only use the command sleep, but via an exec function, we can't use "system"....
Results 1 to 13 of 13