Thread: how to store the pipe the output of a program to string ?

  1. #1
    Registered User
    Join Date
    Apr 2007

    how to store the pipe the output of a program to string ?


    im trieng to help some person with getting the default gateway in c .
    the idea is to use normal bash with route (excuting route to get the default gateway).
    my first idea was to output it to file then reading it from that but then i realized why wont i use pipe ?

    ok the problem is that i don't know how to use it ..
    could you please guide to a tutrial for piping in C ?

    what i need to do is ..
    why Gaos didn't had a wife ?

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Use popen() and read from it like any other file descriptor.
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OOP Question DB Access Wrapper Classes
    By digioz in forum C# Programming
    Replies: 2
    Last Post: 09-07-2008, 04:30 PM
  2. C++ ini file reader problems
    By guitarist809 in forum C++ Programming
    Replies: 7
    Last Post: 09-04-2008, 06:02 AM
  3. Compile Error that i dont understand
    By bobthebullet990 in forum C++ Programming
    Replies: 5
    Last Post: 05-05-2006, 09:19 AM
  4. Replies: 4
    Last Post: 03-03-2006, 02:11 AM
  5. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM