Désactiver Adblock

AdBlock bloque du contenu sur le site

ADBlock errore

Run Unix-based executable file on the same system

StackOverflow https://stackoverflow.com/questions/18180574
 Vérifié

Question

I created a Tic Tac Toe C program on the Eclipse IDE for Mac. Then, when I wanted to run the file on terminal, I wrote the file on VIM and when I ran it worked perfectly. However, the problem I'm having is, when I sent that same executable (I uploaded it to Mediafire and then had them download it) program to many friends who own a Mac with obviously a UNIX-based OS as well, the program never worked. Instead of an executable file, it became a document. What's the reason for that and how do I make my program work on other Unix-based OS's?

Solution

Your friends should mark the program as executable by giving it the "execute" permission. When you upload a file to a server on the Internet all of its attributes like permissions and timestamps are lost.

Another option is uploading the file packed in an archive format that does save attributes. One such option is tar. To create a compressed tar file containing program you can use:

tar czf program.tar.gz program
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow