Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manipulating files opened with popen()

Status
Not open for further replies.

tewari68

Programmer
Jan 25, 2005
87
US
Hi,
Hi,
I am using Clamv as antivirus program to check for any virus infected files.

The command to be executed for checking the files for virus
Code:
 /usr/bin/clamdscan --disable-summary --mbox --stdout /var/tmp/filename
and the result returned by clamv is
Code:
 /var/tmp/filename:Worm.Mydoom.M FOUND, if virus is found
if no virus is found the result returned is
Code:
 /var/tmp/filename : ok

I am using popen(), for "open pipe" this opens a shell and runs the above clamscan command however, it returns a FILE*,
now how can I parse the above results returned by clamscan to grab the name of the virus reported.
I would like to get suggestions of doing it in any other way also. I don't want to use the file redirection method as it entails a lot of overhead, I have to process a bunch of files at a time.

Thanks,
tewari.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top