c++ system() command help

Discussion in 'Software' started by BrokenArrows, Oct 27, 2004.

  1. BrokenArrows

    BrokenArrows Sergeant

    hi,
    im currently writing a program in borland c++.
    In the program i need to add the following command to the registry:

    HKCU\Software\Microsoft\Windows\CurrentVersion\run
    in this key i need to add: subst i: c:\drivei

    i know how to do this using dos by using the command
    reg add HKCU\Software\Microsoft\Windows\CurrentVersion\run /v DriveI /d "subst i: c:\\drivei"

    but my problem is when i input this command in the system(); function it gives an error because of the ""


    this is the command that i need to execute but it gives an error because of the quotes around subst i: c:\\drivei , and these are needed.

    system("
    reg add HKCU\Software\Microsoft\Windows\CurrentVersion\run /v DriveI /d "subst i: c:\\drivei"");



    does anyone have a solution or is there an easier way to do this.
     
  2. Wookie

    Wookie Sergeant Major

    In perl you use a backslash


    so $mystring = "Hello \"bob\"";


    Might work in C++ im not sure, try it.
     
  3. glennk721

    glennk721 MajorGeek

    Hello, this is from a old post on my server I have a C++ programimg guide, feel free to DL a copy, Glenn


    Hello, have uploaded a C++ Programing Guide to my webserver, its a PDF ebook,,,you will need a utility such as Winzip to open the file,and then A PDF File Viewer hope you find this helpfull , Glenn
     
    Last edited by a moderator: Nov 13, 2004

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds