Like Tree1Likes

Piping problem!

This is a discussion on Piping problem! within the Linux Programming forums, part of the Platform Specific Boards category; Elysia is coding against POSIX? I apologize for that huge banging sound you just heard -- that was my jaw ...

  1. #16
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,248
    Elysia is coding against POSIX?

    I apologize for that huge banging sound you just heard -- that was my jaw hitting the floor.

    Anyway, to comprehend the weird arguments to execlp(), think of it this way: the first parameter is the program to execute, that part is obvious. The following parameters will be used to populate the argv[] array of the newly executing program. As we know, the first entry in argv[] should be the name of the program itself, thus you pass it there as well. And the function has a variadic signature, so the compiler is unlikely to catch mistakes when calling it.

    And.. in those moments you're thinking "POSIX really sucks..." Yeah, it does
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  2. #17
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,771
    Quote Originally Posted by brewbuck View Post
    Elysia is coding against POSIX?

    I apologize for that huge banging sound you just heard -- that was my jaw hitting the floor.
    It's a required assignment, so there is not much I can do.
    Don't worry. I accept your apology XD

    Regarding execlp... that was my mistake. I didn't consider the first argument is the name/path of the process itself. I knew that, of course, but I forgot to pass that in as the first argument.

    Actually, POSIX functions are very easy to call and use, which is nice compared to Windows. It just goes to show how much of a mess the Win32 API is.
    I suppose I could use execvp, but execlp is more convenient!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #18
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,248
    Quote Originally Posted by Elysia View Post
    Actually, POSIX functions are very easy to call and use, which is nice compared to Windows. It just goes to show how much of a mess the Win32 API is.
    That's true.. But I think the two APIs suck for different reasons. Win32 because it's so big and complicated, POSIX because it's too simple. You can accomplish almost anything in either one, but you'll be pulling your hair out for different sorts of reasons, depending.
    Elkvis likes this.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Implementation of Shell -- Problem in multiple piping
    By ani_pwl in forum C Programming
    Replies: 4
    Last Post: 10-22-2011, 10:00 AM
  2. Problem with piping in my simple UNIX shell
    By Integral Birth in forum C Programming
    Replies: 0
    Last Post: 11-28-2010, 06:37 PM
  3. programming unix shell piping problem
    By Kyro in forum Linux Programming
    Replies: 2
    Last Post: 08-28-2003, 07:52 AM
  4. piping....
    By coolDUDE in forum C Programming
    Replies: 1
    Last Post: 11-18-2002, 04:42 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21