문제

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