double-click C executable.

Joined
Mar 28, 2007
Messages
1
Reaction score
0
Points
1
hey guys.
I don't have a Mac, so I need your help here. If, on Mac OS X, one write some C code, then compiles it with
Code:
gcc -o binaryfile code.c

then puts binaryfile on the Desktop and double-clicks it, what will happen? Will in run as if you typed
Code:
./binaryfile

on the command line?

What if binaryfile doesn't have execute permissions set? What happens whet it gets double clicked?

Thanks for help.:D
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
From the Finder, it will execute as expected if it has execute permissions set. If Terminal is not open, then it is first opened to the users home directory. Upon exit of the executable, the terminal exits the shell and leaves a message saying "[Process completed]".

If the file does not have execute permission, Terminal is still opened and is left in the users home directory at a live prompt.

When the user is already has the Terminal opened and tries to execute a file without execute permission, the user gets a Permission denied" error.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top