GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 28-Feb-2007, 23:25
sitha sitha is offline
Junior Member
 
Join Date: Jul 2006
Posts: 31
sitha is on a distinguished road

Run exe file in C++ coding


Hi Everybody,
I want to run a Fortran EXE file in C++ coding, following coding I wrote and compile with cygwin g++ compiler.......

CPP / C++ / C Code:
void runsystem (string)

int main()
{
string cmm;
cmm="universe.exe";
runsystem (cmm)
}

void runsystem(string cmm)
{
system(cmm.c_str());
}

When I compile it works fine without any trouble. But when I run it shows following error........
Code:
sh: universe.exe: command not found // made correction in error

Please help me to solve this problem...............Thanks in advance.

Regards,
Sitha.
Last edited by LuciWiz : 03-Mar-2007 at 16:43. Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
  #2  
Old 01-Mar-2007, 14:14
ubergeek ubergeek is offline
Regular Member
 
Join Date: Jan 2005
Posts: 775
ubergeek is a jewel in the roughubergeek is a jewel in the roughubergeek is a jewel in the rough

Re: Run exe file in C++ coding


See that Edit button? It prevents you from having to double post.

The error means exactly what it says. universe.exe isn't in the same directory as your program's executable, thus it was not found. system() does exactly the same thing as typing a command into the shell.
  #3  
Old 01-Mar-2007, 14:25
killzone killzone is offline
Junior Member
 
Join Date: Nov 2006
Posts: 66
killzone is an unknown quantity at this point

Re: Run exe file in C++ coding


in Unix change
Code:
bash>> universe.exe

To
Code:
./universe

In Unix to run your programs you use ./(program) instead of the windows universe.exe
  #4  
Old 02-Mar-2007, 00:15
sitha sitha is offline
Junior Member
 
Join Date: Jul 2006
Posts: 31
sitha is on a distinguished road

Re: Run exe file in C++ coding


See that Edit button? It prevents you from having to double post.
Quote:
Originally Posted by ubergeek
The error means exactly what it says. universe.exe isn't in the same directory as your program's executable, thus it was not found. system() does exactly the same thing as typing a command into the shell.

But universe.exe is in the same directory!!!!!!!!!!!!!!
  #5  
Old 02-Mar-2007, 00:19
sitha sitha is offline
Junior Member
 
Join Date: Jul 2006
Posts: 31
sitha is on a distinguished road

Re: Run exe file in C++ coding


Quote:
Originally Posted by killzone
in Unix change
Code:
bash>> universe.exe

To
Code:
./universe

In Unix to run your programs you use ./(program) instead of the windows universe.exe
Thanks a lot .............It works fine now..
I spent lot of time to solve this trouble. But your idea helped me lot..........
 
 

Recent GIDBlogPython ebook by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Airport Log program using 3D linked List : problem reading from file batrsau C Programming Language 11 29-Feb-2008 08:44
Download files in c for windows operating system oozsakarya C Programming Language 5 20-Jun-2006 04:33
Coding Contest #1 davis Miscellaneous Programming Forum 0 12-Jun-2006 09:29
CD burner wont burn!! robertli55 Computer Hardware Forum 1 18-Jun-2004 11:53
Yet another CD burner problem: Lite-On LSC-24082K Erwin Computer Hardware Forum 1 22-May-2004 12:28

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 17:48.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.