A Little help here

This is a discussion on A Little help here within the C++ Programming forums, part of the General Programming Boards category; hi,,, consider this program, Code: #include<process.h> int main() { System("DIR"); return 0; } this actually prints the contents of the ...

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    8

    Post A Little help here

    hi,,,

    consider this program,
    Code:
    #include<process.h>
    
    int main()
    {
           System("DIR");
           return 0;
    }
    this actually prints the contents of the local directory,, is there any way that i can use the result of that system call...

    ** like storing in a file

    Regards,
    Rajasekaran

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    dir > a.txt
    or use the Windows API directly, without using SYSTEM call that is unsecure
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,447
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,473
    Quote Originally Posted by Salem
    Have I missed something?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  5. #5
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,475
    Either he's having a funny five minutes or it may of been asked elsewhere. Il let you decide.
    I'm just trying to be a better person - My Name Is Earl

Popular pages Recent additions subscribe to a feed

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