Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > How to run a.out?

How to run a.out?
Thread Tools
Fresh-Faced Recruit
Join Date: Jun 2006
Status: Offline
Reply With Quote
Apr 16, 2006, 07:50 PM
 
In my computer science class (C++) we have been using Emacs to write the programs, and then using g++ to create the computers. It works fine on the campus *nix boxes.

On my MacBook, I have no problem compiling it (ex. "g++ text.cpp"). It then spits out a program, "a.out". On the campus machines, I just have to type in "a.out" and the program runs. On the Mac, it doesn't.

Any ideas?
     
Addicted to MacNN
Join Date: Oct 2001
Location: Yokohama, Japan
Status: Offline
Reply With Quote
Apr 16, 2006, 10:06 PM
 
./a.out
     
Fresh-Faced Recruit
Join Date: Jun 2006
Status: Offline
Reply With Quote
Apr 16, 2006, 10:26 PM
 
Thanks so much! I feel like I should have known that.
     
Addicted to MacNN
Join Date: Oct 2001
Location: Yokohama, Japan
Status: Offline
Reply With Quote
Apr 18, 2006, 11:49 PM
 
Your school boxes probably have the current directory (.) in the $PATH. By default OS X does not due to security concerns. You can change this in your ~/.profile, ~/.bashrc, etc. if you want.

export PATH="$PATH:."
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Apr 19, 2006, 03:04 AM
 
Putting the current directory in the executable search path is considered a minor security risk, just incidentally.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Professional Poster
Join Date: Sep 2005
Location: Rochester, NY
Status: Offline
Reply With Quote
Apr 19, 2006, 07:33 AM
 
Originally Posted by Chuckit
Putting the current directory in the executable search path is considered a minor security risk, just incidentally.
Heh! I knew a CS major back in the day who got fed up of people copying other people's work by looking through their home directories and finding classmates who hadn't bothered to restrict the permissions on the project files in their home directory. this was strictly against the class rules, of course, but that didn't stop some people. He set up permissions in his own directory appropriately, but still didn't like the fact that these people could take advantage of other students' negligence.

The school, by default, put the current directory in the search path, which he removed for his own account in his startup script. He then opened up access to his home directory, created a file named "ls", put "rm -rf ~" in it, made it executable, and put it in his home directory. Hilarity ensued. Nobody could turn him in, because if they did, they'd be basically admitting that they were looking through his files, which was against the class rules.

At least, that's what he told me at the time, and those memories are filtered through about twelve years worth of Guinness, so they may not be 100% accurate....
     
Professional Poster
Join Date: Sep 2005
Location: Rochester, NY
Status: Offline
Reply With Quote
Apr 19, 2006, 08:45 AM
 
Ahh yes, it's coming back to me now. The school defaulted to having the current directory in the path as the last item, which would have rendered this little trick useless. The jokers that my friend targeted, though, thought that was a bug because when they named their output "test" it found the Unix "test" program first in the path, which (IIRC) returns no output. So they moved the ./ directory to first on the path list, without regard for possible security implications.

Thank you for indulging my hazy trip down memory lane. We'll nnow return you to your regularly scheduled UNIX forum....
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:47 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2