using several wget-s in separate threads

This is a discussion on using several wget-s in separate threads within the C++ Programming forums, part of the General Programming Boards category; Is it possible to rim wget (via a system() call, per example), without having it overwrite data in my main ...

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    85

    using several wget-s in separate threads

    Is it possible to rim wget (via a system() call, per example), without having it overwrite data in my main program output? Like, in a thread? Or even better, several concomittent wget-s in separate threads?

    How can I get the data that will be written to stdout normally? I need to run this wgets hidden, since the data will be reported in the main program (which will have a gui)

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Is popen() / _popen() roughly what you want?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Aug 2007
    Posts
    85
    well, except that it spits all the cout data in my main program. I want that data accessible to my program, but not shown on my program's console.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Not if you do it right, I would think. But here's a different approach, assuming you are using Windows, rather than Linux:
    Creating a Child Process with Redirected Input and Output

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Aug 2007
    Posts
    85
    you've got to be kidding me. all that code for spawning a process? :/

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    No, not kidding - that's an alternative to using _popen() - but maybe you want to give it another try first?

    And why do you care how much code it is, if all you need to do is copy'n'paste it? It's pretty self-explanatory if you know how these things work in general.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 10-17-2008, 11:28 AM
  2. Yet another n00b in pthreads ...
    By dimis in forum C++ Programming
    Replies: 14
    Last Post: 04-07-2008, 12:43 AM
  3. Classes and Threads
    By Halloko in forum Windows Programming
    Replies: 9
    Last Post: 10-23-2005, 05:27 AM
  4. problem with win32 threads
    By pdmarshall in forum C++ Programming
    Replies: 6
    Last Post: 07-29-2004, 02:39 PM
  5. Block and wake up certain threads
    By Spark in forum C Programming
    Replies: 9
    Last Post: 06-01-2002, 03:39 AM

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