i am not getting this program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • paramjeet kaur
    New Member
    • Sep 2010
    • 5

    i am not getting this program

    #include<stdio. h>

    void main()
    {
    system("reg add HKEY_LOCAL_MACH INE\\SYSTEM\\Cu rrentControlSet \\Services\\USB STOR \/v Start \/t REG_DWORD \/d 4 \/f");
    }
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    It is a simple program that makes a call the to reg utility shipped with windows.

    Go to a command prompt and type reg to get some simple help on that utility or try a web search.

    Comment

    • paramjeet kaur
      New Member
      • Sep 2010
      • 5

      #3
      1. is system is a function ?
      2. can a function can be called without declaring it ?
      3. what is the use of /v,/t,/d,/f in this progrm?

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        system is a standard library function and it is declared in stdlib.h

        In C you can call a function without declaring it although it is not advisable.

        The /v /t /d /f are command line switches being passed to the reg utility.

        Comment

        • newb16
          Contributor
          • Jul 2008
          • 687

          #5
          The only weird thing is escaped forward slash ( \/ ) that is not at least in C++ standard. (...If the character following a backslash is not one of those specified, the
          behavior is undefined...). And yes, void main() is also nonstandard.

          Comment

          • donbock
            Recognized Expert Top Contributor
            • Mar 2008
            • 2427

            #6
            Refer to the sticky post at the front of the C answers forum: PLEASE READ FIRST: Useful Links and Posting Guidelines. The first reply in this thread contains helpful links, including two library references (note the advice that you bookmark those references). Either of those library references will lead you to a manual-page for the system function.

            Library function system passes its string argument to the command shell. It is as if you typed that string in a command window. What happens next has nothing to do with C -- it depends on how your system reacts to that command string.

            Comment

            Working...