Chmod command problem

This is a discussion on Chmod command problem within the C Programming forums, part of the General Programming Boards category; Originally Posted by swoopy >For my last assignment, it was in the same way, he released the binary What was ...

  1. #16
    Cogito Ergo Sum
    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    463
    Quote Originally Posted by swoopy View Post
    >For my last assignment, it was in the same way, he released the binary
    What was that one called, hw0?
    Actually his example was for hw1 the first assignment, i never used the binary of the 1st assignment.

    I used the binary for the second assignment hw2, but since the command doesn't change because the file name is different, I used that, and I remember it didn't work properly, but I did mess around with the extensions and I entered some command and it produced an executable.

    I am currently trying to replicate that for the third assignment, hw3

  2. #17
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    You know I'm now wondering if you had Cygwin installed, if the hw1 would run under that.

  3. #18
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    Quote Originally Posted by JFonseka View Post
    according to my lecturer to turn his sample solution into an executable to run on windows I need to type:

    chmod a+x hw3
    Sounds like your lecturer is on some serious hallucinogens.

  4. #19
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Your teacher is nuts.
    Ask for you money back.

  5. #20
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Indeed. There is no such thing as "execute" bits on a Windows system. There is in Linux/Unix, but not in Windows. Instead, the Windows command line shell determines how to "execute" something based on the extension of the file. Write a text-file called "Blah.txt" in noetpad. Now rename it to Blah.com, type blah in command line [in the appropriate directory] and see if crash! [This doesn't work for .exe files, since .exe files have a bit more complex structure, and thus the OS will realize that it's not an exectuable file and fail to load it in the first place].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #21
    Cogito Ergo Sum
    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    463
    Quote Originally Posted by cpjust View Post
    Your teacher is nuts.
    Ask for you money back.
    Err no, I did this myself when messing around with commands when he released hw2

    I got the executable for hw2 and it's with me

    I don't care if you get Linus Torvalds to come and explain it's not possible, because I got the executable I made by entering some random command I found online earlier or finding it in the 'man'.

    I got the evidence, it's hw2.exe and it came from the binary he released.

  7. #22
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by JFonseka View Post
    Err no, I did this myself when messing around with commands when he released hw2

    I got the executable for hw2 and it's with me

    I don't care if you get Linus Torvalds to come and explain it's not possible, because I got the executable I made by entering some random command I found online earlier or finding it in the 'man'.

    I got the evidence, it's hw2.exe and it came from the binary he released.
    Well, under Windows, "chmod +x blah" will do absolutely nothing, so how that "makes it work" is probably more to do with some other random coincident. And I suspect Linus will not be able to explain that. If you have a file called ".exe", it by 99% certainly didn't come from a Linux machine. chmod definitely will not produce a .exe file from a Linux executable, because that is nearly impossible to achieve [it would be technically possible to generate the code if you have a compatibility shared library loader and convert the input ELF file into a COFF format - but it's certainly not something "chmod" would do].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  8. #23
    Cogito Ergo Sum
    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    463
    Quote Originally Posted by matsp View Post
    Well, under Windows, "chmod +x blah" will do absolutely nothing, so how that "makes it work" is probably more to do with some other random coincident. And I suspect Linus will not be able to explain that. If you have a file called ".exe", it by 99% certainly didn't come from a Linux machine. chmod definitely will not produce a .exe file from a Linux executable, because that is nearly impossible to achieve [it would be technically possible to generate the code if you have a compatibility shared library loader and convert the input ELF file into a COFF format - but it's certainly not something "chmod" would do].

    --
    Mats
    Yea I know, it's not something chmod did do, I first entered that like I said, and nothing happened, and then spending around 15 minutes typing commands and looking at the man page i saw some command and typed that.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with my copy programme
    By Tru_Messiah in forum C Programming
    Replies: 8
    Last Post: 12-15-2004, 09:04 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21