1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

System statements in C

Discussion in 'C' started by Virtualz, Jul 18, 2008.

  1. Virtualz

    Virtualz New Member

    Joined:
    Jul 17, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Hi.

    I need help with some coding in C

    I want to extract some registry info from HKCU (Current user) named "Volatile Environment"

    Here's how to do it:

    c:\>reg save "hkcu\volatile environment" <filename>

    This is to extract the info.

    Now the problem.....

    /code

    #include<stdio.h>

    main()
    {
    system("reg save "hkcu\volatile environment" <filename>");
    }


    It does not want to accept the above as valid code in Dev-cpp.

    Anyone know how to do this?

    Thanx
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Can't see any reason why that shouldn't work, if the command is exactly the same as the command line version. Don't forget that if you try to include a " inside a string that will actually terminate the string, so if the code is exactly as pasted I bet you're getting errors about some unknown symbol hkcu. \ is the escape character so \" will get you an embedded quote in a string, and of course the backslash in \v will need escaping as well.
     
  3. Virtualz

    Virtualz New Member

    Joined:
    Jul 17, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    0
    Thanx mate, I got it right!!
     

Share This Page