PDA

View Full Version : saving with .c extension




aStabell
Apr 3, 2009, 11:10 AM
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



dejo
Apr 3, 2009, 11:17 AM
TextEdit will let you save files as .c

angelwatt
Apr 3, 2009, 11:21 AM
There's plenty of free text editors that will let you e.g., TextWrangler, Smultron, Xcode, etc.

lee1210
Apr 3, 2009, 11:56 AM
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

aStabell
Apr 3, 2009, 11:57 AM
TextEdit will let you save files as .c


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

aStabell
Apr 3, 2009, 12:03 PM
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

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)

dejo
Apr 3, 2009, 12:12 PM
Texteditor actually doesn't let me save .c extensions for some reason.
Texteditor? Is this something different from TextEdit? The app with this icon?
http://theapplefiles.com/wp-content/uploads/2008/06/textedit.png
Cuz, although it complained initially about saving with a .c extension, I was certainly able to do so.

aStabell
Apr 3, 2009, 12:33 PM
Texteditor? Is this something different from TextEdit? The app with this icon?
http://theapplefiles.com/wp-content/uploads/2008/06/textedit.png
Cuz, although it complained initially about saving with a .c extension, I was certainly able to do so.

that's what I'm using, I attached a screen shot of the error message when I try to save it that way

dejo
Apr 3, 2009, 12:39 PM
that's what I'm using, I attached a screen shot of the error message when I try to save it that way
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.