Running a EXE -Don't Yell! I checked The FAQ...

This is a discussion on Running a EXE -Don't Yell! I checked The FAQ... within the C Programming forums, part of the General Programming Boards category; okay. i checked and tryed all the ways to run an exe in the FAQ, but none of them worked. ...

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    83

    Running a EXE -Don't Yell! I checked The FAQ...

    okay. i checked and tryed all the ways to run an exe in the FAQ, but none of them worked. i don't know if those were ment for a C++ program or if it just don't work with my compiler. is there another way. thanks.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Double click the pretty little icon...

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,699
    What in gods name are you talking about? How to click and run an exe? How to make one?
    ??
    Code:
    bool fun(bool value)
    {
        return std::pow(std::exp(1), std::complex<float>(0, 1) 
        * std::complex<float>(std::atan(1)*(1 << (value + 2))))
        .real() > 0;
    }

  4. #4
    Registered User
    Join Date
    May 2002
    Posts
    83

    run an exe

    lol. sorry lookin over it now, forgot to put "Run an exe through another program written in C"
    "What this country needs is more free speech worth listening to." - -Hansell B. Duckett

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    I really doubt you tried all the options in the FAQ then. If you had, you'd have found they all work.

    Quzah.
    Hope is the first step on the road to disappointment.

  6. #6
    Registered User
    Join Date
    May 2002
    Posts
    83

    well sorrry!

    they don't work with me.
    "What this country needs is more free speech worth listening to." - -Hansell B. Duckett

  7. #7
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    I guess I'll use my astounding mental powers to analize the code you have then, huh? I am seeing... Ah, yes, there it is. I see the problem.

    Now you can use your astounding mental powers to read my mind, and get the answer.

    Quzah.
    Hope is the first step on the road to disappointment.

  8. #8
    Registered User
    Join Date
    Dec 2001
    Posts
    108
    Assuming that you want to invoke one Win32 program from another, #include <windows.h> and use WinExec("program.exe", SW_SHOWNORMAL);.

  9. #9
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >they don't work with me.
    Fascinating that they work for everyone who uses them correctly yet you are having problems. The logical conclusion to this is that you're doing it wrong. Post your code and we'll tell you why and how to fix it.

    -Prelude
    My best code is written with the delete key.

  10. #10
    Registered User
    Join Date
    May 2002
    Posts
    83

    source

    ive tried:

    1)
    #include <windows.h>

    main()
    {
    WinExec("myfile.exe");
    }

    2)
    #include <stdlib.h>

    int main(void)
    {
    system("myfile.exe");
    return 0;
    }

    and spawn but already trashed that file

    also there were some variables i n these but they caused errors when i tried to compile. these all compiled but didn't run the exe
    "What this country needs is more free speech worth listening to." - -Hansell B. Duckett

  11. #11
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Here ya go:

    Code:
    #include <stdio.h>
    #include <stdlib.h> 
    int main ( void )
    {
        printf("Cascading doom.\n");
        fflush( stdout );
        system( "test.exe" );
        return 0;
    }
    Save this as 'test.c'. Compile this as 'test.exe'. Run 'test.exe' from a command prompt. Enjoy.

    Quzah.
    Hope is the first step on the road to disappointment.

  12. #12
    Im back! shaik786's Avatar
    Join Date
    Jun 2002
    Location
    Bangalore, India
    Posts
    345
    You could include absolute path in system() instead, as:
    Code:
    system("C:\\Workarea\\test.exe");

  13. #13
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Originally posted by quzah
    Here ya go:
    <snip code>
    Save this as 'test.c'. Compile this as 'test.exe'. Run 'test.exe' from a command prompt. Enjoy.

    Quzah.
    Ooohh, you're evil
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  14. #14
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Originally posted by Hammer

    Ooohh, you're evil
    No, I'm being helpful and showing that it does in fact work. (It doesn't in fact work in MSVC++ until you run it from the command prompt rather then the IDE. Very odd.

    Quzah.
    Hope is the first step on the road to disappointment.

  15. #15
    Registered User
    Join Date
    Aug 2001
    Posts
    403

    Post

    that has to do with the IDE search path.. if that is set to the right dir it will work.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Wiki FAQ
    By dwks in forum A Brief History of Cprogramming.com
    Replies: 192
    Last Post: 04-29-2008, 01:17 PM
  2. multithreading question
    By ichijoji in forum C++ Programming
    Replies: 7
    Last Post: 04-12-2005, 10:59 PM
  3. FAQ : running program inside program (spawn)
    By nipun in forum C Programming
    Replies: 3
    Last Post: 06-13-2004, 02:30 PM
  4. FAQ Check/Lock
    By RoD in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 10-15-2002, 11:21 AM
  5. running exe files from a c++ program
    By Leeman_s in forum C++ Programming
    Replies: 3
    Last Post: 09-17-2002, 01:17 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21