Search:

Type: Posts; User: quo

Page 1 of 5 1 2 3 4

Search: Search took 0.01 seconds.

  1. Thread: sort file

    by quo
    Replies
    13
    Views
    1,351

    do I have to use a bash script for this? also if...

    do I have to use a bash script for this?
    also if I want the sorting to be according the second field (the float) how can I achieve that with one command?
  2. Thread: sort file

    by quo
    Replies
    13
    Views
    1,351

    sort file

    hello everyone!
    I have a file which has records with 2 fields--one int and one float---
    what is the best way to sort it?
    The sorting has to be based on the int field(the first field)
    (each time...
  3. Thread: multiple pointers

    by quo
    Replies
    4
    Views
    894

    multiple pointers

    hello everyone

    I have a stupid question.When I have allocated a



    char* a;


    to point to an array of chars.And then I want a
  4. Thread: itoa

    by quo
    Replies
    5
    Views
    1,124

    Thank you guys for your answers!I will try both...

    Thank you guys for your answers!I will try both methods!
  5. Thread: itoa

    by quo
    Replies
    5
    Views
    1,124

    Thank you for your answer.I have never used that...

    Thank you for your answer.I have never used that before and although I googled it I couldn't quite understand how it's working..
    Could you please give me a simple example?
  6. Thread: itoa

    by quo
    Replies
    5
    Views
    1,124

    itoa

    I was wondering if I have a declaration such as:


    #define worker_id1 2311

    and at some point of my program I want to print


    worker_id1
  7. Thread: fopen issue

    by quo
    Replies
    1
    Views
    690

    fopen issue

    hi guys

    what I want is to create a file only if it doesn't exist otherwise if the file exists I want to print an error.Also an error has to be returned if the creation of the file was...
  8. Thread: list of structs

    by quo
    Replies
    8
    Views
    1,430

    Thank you for your answer.So if I do what you...

    Thank you for your answer.So if I do what you suggest then I do not need to do this as well for every object right?



    a[i] = (A *) malloc (sizeof(struct A));



    This is what I did for...
  9. Thread: list of structs

    by quo
    Replies
    8
    Views
    1,430

    Ok thank you I think I've understood now. I have...

    Ok thank you I think I've understood now.
    I have one more question
    When it comes to arrays and I want to allocate an array of structs then how should I do it ?
    Like this:



    struct A **a =...
  10. Thread: list of structs

    by quo
    Replies
    8
    Views
    1,430

    Yes I must have been a bit confused..No I...

    Yes I must have been a bit confused..No I certainly want a list of elements.

    So for a list how should I initilize it?
  11. Thread: list of structs

    by quo
    Replies
    8
    Views
    1,430

    list of structs

    hi guys i'm having the following problem with my code.
    I have a struct that represents a list :



    struct list_of_elements{

    int number_of_elements; //counter of list elements
    A*...
  12. Replies
    1
    Views
    1,116

    write char* to socket

    hi guys

    I have a C program where I need to write to a socket a char*
    In fact I have a char* message


    char* message = "things to be read";
    if(write(sockdes,message,sizeof message)<0)
    ...
  13. Thread: buffer issue

    by quo
    Replies
    5
    Views
    908

    thanks that was useful! what if I want after...

    thanks that was useful!
    what if I want after printing the contents of the buffer to restore new stuff in there?
    I can do:


    i=-1

    all over again,but maybe the second time the data will not...
  14. Thread: buffer issue

    by quo
    Replies
    5
    Views
    908

    buffer issue

    hi guys

    I have a program where I read data char by char and store them into a buffer.Every byte I read I want to put it in the buffer so I do this:


    char buf[128];
    char c;
    //read one char...
  15. Thread: void* error

    by quo
    Replies
    2
    Views
    1,259

    yes you're right!thanks

    yes you're right!thanks
  16. Thread: void* error

    by quo
    Replies
    2
    Views
    1,259

    void* error

    hi all!

    I have a c program and at some point I do:


    void *a;
    allocate(&a);//function that allocates a pointer--this works ok
    memcpy(&b,a+25*sizeof(c),sizeof(int));//c is a struct

    the...
  17. Thread: bash cut string

    by quo
    Replies
    5
    Views
    6,578

    well,how can I use that? could you give me an...

    well,how can I use that?
    could you give me an example?
    the use of sed in order to cut the string when the substring .php is met is not an option?
  18. Thread: bash cut string

    by quo
    Replies
    5
    Views
    6,578

    bash cut string

    hello all

    in my bash script I have some strings that I want to cut up to a specific substring.For example


    www.something.com/dir1/some.php?id=1&ll

    and I only want to keep the link up to...
  19. Thread: signal to process

    by quo
    Replies
    8
    Views
    2,302

    actually I just realized that the child after the...

    actually I just realized that the child after the signal handler function returns to the main function and inside the loop(as it was already inside when it caught the signal)
    but blocks there...
  20. Replies
    30
    Views
    15,322

    thank you guys for your help,actually it was very...

    thank you guys for your help,actually it was very confusing the way I was trying to do it when it came to many child processes so I changed it and used 2 fifo pipes one to send and one to receive...
  21. Thread: signal to process

    by quo
    Replies
    8
    Views
    2,302

    I tried it as you suggested and a strange thing...

    I tried it as you suggested and a strange thing occured..
    In the child process there's the loop:


    while(!c1){
    //do things--I removed sleep()--
    }


    once the child is alive it runs this...
  22. Thread: signal to process

    by quo
    Replies
    8
    Views
    2,302

    Thank you very much for your answer.There're just...

    Thank you very much for your answer.There're just a few things I don't understand,if you could explain to me
    First,what is the use of the volatile int?(Never seen that again before:))
    Secondly,what...
  23. Thread: signal to process

    by quo
    Replies
    8
    Views
    2,302

    I just figured that the problem must be here: ...

    I just figured that the problem must be here:


    waitpid(pids[i],&status,0);

    The parent sends the signal to the first child and receives the answer,executes its function which handles the signal...
  24. Thread: signal to process

    by quo
    Replies
    8
    Views
    2,302

    I am supposed to do send signals both...

    I am supposed to do send signals both directions,is not actually my choice
    The parent when it has finished everything it has to do sends the signal REQ to all children and when they catch it they...
  25. Thread: signal to process

    by quo
    Replies
    8
    Views
    2,302

    signal to process

    I have a parent process and many children.
    The childrens' pids are stored in an array of ints.
    at some point of the program I want to send a signal to all the children from the parent process and...
Results 1 to 25 of 116
Page 1 of 5 1 2 3 4