Вопрос

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?

Это было полезно?

Решение

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
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top