piping....

This is a discussion on piping.... within the C Programming forums, part of the General Programming Boards category; i know that I can call a program in C using the system() function... but after i called it... how ...

  1. #1
    coolDUDE
    Guest

    Angry piping....

    i know that I can call a program in C using the system() function...
    but after i called it... how do i enter extra things into is...

    example:

    when i call the mail program: mail cool@cool.com
    it asks me then for the subject...

    so my question is... is there a way from my C program to send the "Subject" after i called the program with system()...

  2. #2
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    yeah,

    what you can do is:

    system("echo \"this is the body text\" | mail address@yahoo.com -s \"this is the subject\"");

    this will work, but you may want to use a different piping function other than system. system invokes the desired program in a shell with all its privilages. this is less efficient and secure than a function like popen.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. piping a file into my project
    By Tom_Arch in forum C Programming
    Replies: 1
    Last Post: 04-27-2009, 12:41 AM
  2. Advanced Piping Question!
    By Paul22000 in forum C Programming
    Replies: 14
    Last Post: 04-17-2009, 09:55 AM
  3. prevent piping?
    By barneygumble742 in forum C++ Programming
    Replies: 2
    Last Post: 12-29-2005, 12:07 AM
  4. Piping output under .NET
    By sean in forum C# Programming
    Replies: 1
    Last Post: 10-07-2004, 03:20 PM
  5. Piping error messages to a file?
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 02-25-2002, 02:09 PM

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