saving with .c extension

Discussion in 'Mac Programming' started by aStabell, Apr 3, 2009.

  1. macrumors member

    aStabell

    Joined:
    Jan 1, 2004
    #1
    Hey everyone,

    I tried finding a topic on this but was unsuccessful. I'm just starting to learn how to program in C, and instead of being dependent on a computer lab, I would like to use my own laptop to practice and try new things at my leisure. I have already established a shell connection to a Unix computer so I can compile files through that, the problem is that I cannot save the files as .C :confused:

    I've tried texteditor, Script editor and even Word, but everything gives the same error message (saying that the .c extension is not allowed). Is there any way I can do this w/out resorting to windows or the dark musty grounds of the computer lab?

    -Alex
     
  2. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
  3. Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #3
    There's plenty of free text editors that will let you e.g., TextWrangler, Smultron, Xcode, etc.
     
  4. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #4
    You could develop a life-long skill, applicable on any UNIX machine by learning vi now... but there are also plenty of good programmer's text editors on the mac, too.

    That's not the real reason i am posting though, what caught my attention was that you have a shell on a remote UNIX machine for compiling. If you are using OS X, you are already using a UNIX machine. Just compile locally. If you don't have them installed already, install the developer's tools from your OS X DVD, or download XCode from apple's site. This will include gcc, so you can compile on your own machine just like on the UNIX machine (maybe not EXACTLY like if you were going to be using actual cc on some old machine, but it should be close enough).

    -Lee
     
  5. thread starter macrumors member

    aStabell

    Joined:
    Jan 1, 2004
    #5

    Texteditor actually doesn't let me save .c extensions for some reason. Textwrangler worked perfect though, thanks for the help!
     
  6. thread starter macrumors member

    aStabell

    Joined:
    Jan 1, 2004
    #6
    I figured that OSX would have gcc or g++ built in so I tried compiling before resorting to the shell. I'll get XCode, that should simplify things tremendously.

    Another question I had was if terminal worked with on the same language as basic unix? Simple inputs like cd, mkdir, ls etc work so I assumed it was. (I hope this question makes sense, I'm pretty new to all this)
     
  7. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #7
    Texteditor? Is this something different from TextEdit? The app with this icon?
    [​IMG]
    Cuz, although it complained initially about saving with a .c extension, I was certainly able to do so.
     
  8. thread starter macrumors member

    aStabell

    Joined:
    Jan 1, 2004
    #8
    that's what I'm using, I attached a screen shot of the error message when I try to save it that way
     

    Attached Files:

  9. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #9
    Oh, you have Rich Text Formatting turned on. You can make that go away, if you want, by doing a Format > Make Plain Text.

    Anyways, I'm gonna recommend TextWrangler too. Much nicer.
     

Share This Page