Thread: A Little help here

  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
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,794
    dir > a.txt
    or use the Windows API directly, without using SYSTEM call that is unsecure
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    David J. Wheeler

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    35,943
    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.

  4. #4
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,794
    Quote Originally Posted by Salem
    Have I missed something?
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    David J. Wheeler

  5. #5
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,686
    Either he's having a funny five minutes or it may of been asked elsewhere. Il let you decide.
    Double Helix STL

Popular pages Recent additions subscribe to a feed