Search:

Type: Posts; User: chihwahli

Search: Search took 0.01 seconds.

  1. Replies
    19
    Views
    47,806

    Thanks Grumpy, you mean this: what is structure...

    Thanks Grumpy, you mean this:
    what is structure padding - C / C++

    There are ways to calculate it if I recall it right. Thanks for bringing it up. I might have missed it and guess what's wrong...
  2. Replies
    19
    Views
    47,806

    yes, you are right. Structs are used to keep hold...

    yes, you are right. Structs are used to keep hold a set of data that belongs together, like name, address data.

    Will use array. This thread was informative very usefull nevertheless.

    Edit: ...
  3. Replies
    19
    Views
    47,806

    Its a way to write an looping buffer. Going to...

    Its a way to write an looping buffer. Going to use it in a program with 2 threads that share this buffer. One creates numbers and the other gets them off the buffer.
  4. Replies
    19
    Views
    47,806

    Both code sniplets works perfectly! Thumbs up!

    Both code sniplets works perfectly! Thumbs up!
  5. Replies
    19
    Views
    47,806

    Thanks Tomwa and std10093. You both gave the same...

    Thanks Tomwa and std10093. You both gave the same answer.
    &Tomwa: It's just one small pice of the whole program I need to write. I like to try small sample programs to understand things bit by bit....
  6. Replies
    19
    Views
    47,806

    Not yet, my C books says in the arrays area: the...

    Not yet, my C books says in the arrays area: the pointer variable plus one is the 2nd element in an array.
    So I try


    printf("number in buffer is %i\n",*p + i );
    or
    printf("number in...
  7. Replies
    19
    Views
    47,806

    ahh, yes. I forgot I have to use pointers: ...

    ahh, yes. I forgot I have to use pointers:


    struct number *p;

    p = &number;

    int i;
    for(i=0;i<5;i++) {
    printf("number in buffer is %i\n",*p );
  8. Replies
    19
    Views
    47,806

    looping struct

    Hello,

    Thanks in advance. I like to loop through the members of the following struct. How can I do that?




    /*
    I will store the adress of the struct in n, so that it ppoints back the the...
  9. I was wondering if this is a possible way to...

    I was wondering if this is a possible way to solve it:

    - set pipes to non_block
    Reason: Parent can writes and the child read at the same time

    - Child stores the read data into an array

    -...
  10. Thank you Cas, That means I have to implement a...

    Thank you Cas, That means I have to implement a read function to my child process. Then pass the data to execlp.
  11. pipe() read(), write() - more then 128Kb of data

    Hello all,

    Thanking in advance for the answers again!

    I have a program reads from a file then pipes it to a Unix filter program, this last program adds lines to the original file, then prints...
  12. Great! Thanks again Hauzer and Salem.

    Great! Thanks again Hauzer and Salem.
  13. prevent compiler warning: 'X' may be used uninitialized in this function

    Hello,

    Thanking the people who answer in advance. =)
    I fixed my problem by the line from char * mac_str = NULL; to char mac_str[1];

    My questions:
    1) With * mac_str = NULL I get an...
  14. Replies
    5
    Views
    1,738

    I was hoping that the code to print the numeric...

    I was hoping that the code to print the numeric address with less lines, but that would indeed less reliable. Good suggestion about error checking first. Thank you all.
    Following the "pointer" into...
  15. Replies
    5
    Views
    1,738

    Thanks for the answers so far. Correction: I...

    Thanks for the answers so far. Correction: I should have typed inet_pton.
    I learned to type: inet_pton(AF_INET,"192.168.0.1",ip.sin_addr);
    The value is then stored in my struct sockaddr_in.

    Is...
  16. Replies
    5
    Views
    1,738

    inet_pton print without using struct

    Hello, I was wondering if there is any way to convert an IPv4 adres into a numeric with inet_ntop without storing it in a struct, and then print the numeric value.

    Is there any way to print...
Results 1 to 16 of 16