Thread: Use variables in system()

  1. #1

    Use variables in system()

    I'm writing something in XP that changes a user's password simply with: system("net user B-Con PASSWORD")

    The problem is, is that I need to generate the password to be used somewhere else in the program depending on other input..... so basically: How do I insert variables in the system() funcion?

    Thanx
    "Cryptographically secure linear feedback shift register based stream ciphers" -- a phrase that'll get any party started.

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

  3. #3
    thanx
    "Cryptographically secure linear feedback shift register based stream ciphers" -- a phrase that'll get any party started.

  4. #4
    Intmainer
    Join Date
    May 2004
    Posts
    7
    yeh, the FAQ is useful...

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    The function is standard.

    What you pass to it is implementation specific (except for one case, which I'll leave to those who want to read the manual)
    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.

  6. #6
    Registered User
    Join Date
    May 2004
    Posts
    127
    Quote Originally Posted by C+++C_forever
    ok thanks
    1) but the compiler can not see if what you pass to the function is not compatible with the system. if it's a wrong command ( at run time ) it will return ( and not the compiler.. the function ) an error return value ( that i forget now ) right?

    2) what's that one case? i am very interested...
    thanks
    Do you realize that the majority of your questions can be answered by reading a manual? Most programmers find it annoying when you ask a question that can be easily answered with a look through the relevant manual or a web search.
    When writing a specialization, be careful about its location; or to make it compile will be such a trial as to kindle its self-immolation.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 06-13-2005, 09:03 AM
  2. Replies: 3
    Last Post: 06-13-2005, 07:28 AM
  3. Why Can't C++ Be Used to Develop Operating System?
    By Antigloss in forum C++ Programming
    Replies: 7
    Last Post: 05-27-2005, 06:16 AM
  4. Putting variables in SYSTEM
    By mycro in forum C++ Programming
    Replies: 3
    Last Post: 05-29-2003, 07:59 PM
  5. System Calls && Variables
    By Okiesmokie in forum C++ Programming
    Replies: 6
    Last Post: 03-06-2002, 09:10 PM