google-site-verification: googlebaca44933768a824.html OMFG WITH SYSTEM() - Old Royal Hack Forum

Announcement

Collapse
No announcement yet.

OMFG WITH SYSTEM()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    OMFG WITH SYSTEM()

    system("C:/Program Files/Skype/Phone/Skype.exe");

    when inserting this to my programs's code, I get shit like: C:/Program is not a program blaa blaa. why?

    If you have better ways to launch an application from c++, please tell me.

    The thing I need is that the program I open (Skype) will remain opened after I close my own c++ program. So I thought system() would be a good way to do it. but why the hell is it this hard ? BATCH
    ok bai

    #2
    Re: OMFG WITH SYSTEM()

    Originally posted by lolimsoasd
    system("C:/Program Files/Skype/Phone/Skype.exe");

    when inserting this to my programs's code, I get shit like: C:/Program is not a program blaa blaa. why?

    If you have better ways to launch an application from c++, please tell me.

    The thing I need is that the program I open (Skype) will remain opened after I close my own c++ program. So I thought system() would be a good way to do it. but why the hell is it this hard ? BATCH
    If you change the code to:
    system("Skype.exe");
    and put skype.exe in the debug path/or output folder when building release, does it work then?

    Comment


      #3
      Re: OMFG WITH SYSTEM()

      u need to put the whole thing in quotes to account for the space.
      what your code does its try to launch the program "C:\Program" with "Files\Skype\Phone\Skype.exe" as a parameter.
      also since u are on windows i recommend using backslashes in paths.
      do it like this:
      Code:
      system("\"C:\\Program Files\\Skype\\Phone\\Skype.exe\"");

      Comment


        #4
        Re: OMFG WITH SYSTEM()

        Originally posted by b2k5 View Post
        u need to put the whole thing in quotes to account for the space.
        what your code does its try to launch the program "C:\Program" with "Files\Skype\Phone\Skype.exe" as a parameter.
        also since u are on windows i recommend using backslashes in paths.
        do it like this:
        Code:
        system("\"C:\\Program Files\\Skype\\Phone\\Skype.exe\"");
        thank you. every day I learn something new... :D

        edit: damn, now my program won't execute the next command I have there. It will be executed if I close Skype..

        edit2: using now WinExec to open the Skype. works well !

        Code:
        WinExec("\"C:\\Program Files\\Skype\\Phone\\Skype.exe\"",SW_SHOWNORMAL);
        Last edited by lolimsoasd; 11-18-2011, 10:48 PM.
        ok bai

        Comment


          #5
          Re: OMFG WITH SYSTEM()



          Security Remarks

          The executable name is treated as the first white space-delimited string in lpCmdLine. If the executable or path name has a space in it, there is a risk that a different executable could be run because of the way the function parses spaces. The following example is dangerous because the function will attempt to run "Program.exe", if it exists, instead of "MyApp.exe".

          WinExec("C:\\Program Files\\MyApp", ...)

          If a malicious user were to create an application called "Program.exe" on a system, any program that incorrectly calls WinExec using the Program Files directory will run this application instead of the intended application.

          To avoid this problem, use CreateProcess rather than WinExec. However, if you must use WinExec for legacy reasons, make sure the application name is enclosed in quotation marks as shown in the example below.

          WinExec("\"C:\\Program Files\\MyApp.exe\" -L -S", ...)
          lolmaoman: Germans are born with a lifetime x22 login engraved into their birth certificates. True story.
          I DONT HAVE TEAMVIEWER AND IM NOT GOING TO GIVE ANY 24/7 ONLINE SUPPORT VIA STEAM, XFIRE OR OTHER IM PROGRAMS SO DONT BOTHER ASKING. THANKS.

          Comment


            #6
            Re: OMFG WITH SYSTEM()

            yeah, that's what I found out :D
            ok bai

            Comment

            Working...
            X