Thread: piping....

  1. #1

    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...


    when i call the mail program: mail
    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

    what you can do is:

    system("echo \"this is the body text\" | mail -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, 01: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, 03:09 PM