Thread: Redirecting stdoutput to buffer

  1. #1
    Registered User
    Join Date
    Jan 2005

    Question Redirecting stdoutput to buffer

    I am using Clamv as antivirus program to check for any virus infected files.
    How do I execute the command for invoking the antivirus program and interpret the results.
    System only indicates whether the command was executed successfully or not, however I need to get the results returned by Clamv.

    The command to be executed for checking the files for virus

    /usr/bin/clamdscan --disable-summary --mbox --stdout /var/tmp/filename

    and the result returned by clamv is
    /var/tmp/filename:Worm.Mydoom.M FOUND, if virus is found
    if no virus is found the result returned is
    /var/tmp/filename : ok
    I have to put this result in a variable and then manipulate the string variable to get the name of the virus returned.
    I don't want to redirect the stdoutput to a file as this will entail a lot of overhead (I have to process large amount of files at a time).
    I know that we can put the results returned into a buffer and then copy that buffer into a variable, however I am very new to C++ programming so don't know exactly how to do this.

    Would appreciate any help in this regard

  2. #2
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    I've never done it before myself, but with enough research I'm sure you can make it work:
    Use Pipes
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    If you aren't using Windows (as it appears), search the boards and google for how to use popen().


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  2. writing a pack-style function, any advices?
    By isaac_s in forum C Programming
    Replies: 10
    Last Post: 07-08-2006, 08:09 PM
  3. buffer contents swapping
    By daluu in forum C++ Programming
    Replies: 7
    Last Post: 10-14-2004, 02:34 PM
  4. Tetris Questions
    By KneeGrow in forum Game Programming
    Replies: 19
    Last Post: 10-28-2003, 11:12 PM
  5. Console Screen Buffer
    By GaPe in forum Windows Programming
    Replies: 0
    Last Post: 02-06-2003, 05:15 AM