Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Redirect Stdout


  • Please log in to reply
1 reply to this topic

#1 Billy O'Neal

Billy O'Neal

    Visual C++ STL Maintainer


  • Malware Response Team
  • 12,301 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:09:12 PM

Posted 15 April 2008 - 09:51 PM

Hello all! I am looking for someone who knows a little more about the system() call in C++ than I do.

I have written a tool outlined here: http://www.bleepingcomputer.com/forums/ind...logid=1249&
to help around here at BC. I want to convert my tool to C++ instead of batch files. The reason? I need to have string manipulation to par down the event logs to something that fits in a post.

Long story short, in a batch file, I can use the > or >> operators to redirect stdout of a program to a text file. I have already tried something like
system("ipconfig /all >> c:\report.txt");
and it does not work. :thumbsup:

Any ideas on redirecting the output of a external program call in C/C++?

Billy3
Twitter - My statements do not establish the official position of Microsoft Corporation, and are my own personal opinion. (But you already knew that, right?)
Posted Image

BC AdBot (Login to Remove)

 


m

#2 Billy O'Neal

Billy O'Neal

    Visual C++ STL Maintainer

  • Topic Starter

  • Malware Response Team
  • 12,301 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:09:12 PM

Posted 16 April 2008 - 04:56 PM

Alright... I figured it out. Now I want to kick myself. This is wrong:
system("ipconfig /all >> c:\report.txt");
this is correct
system("ipconfig /all >> C:\\report.txt");

Thanks anyway all!

Billy3
Twitter - My statements do not establish the official position of Microsoft Corporation, and are my own personal opinion. (But you already knew that, right?)
Posted Image




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users