Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

aStabell

macrumors member
Original poster
Jan 1, 2004
61
0
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
 

angelwatt

Moderator emeritus
Aug 16, 2005
7,852
9
USA
There's plenty of free text editors that will let you e.g., TextWrangler, Smultron, Xcode, etc.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
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

macrumors member
Original poster
Jan 1, 2004
61
0
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

macrumors member
Original poster
Jan 1, 2004
61
0
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

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
Texteditor actually doesn't let me save .c extensions for some reason.
Texteditor? Is this something different from TextEdit? The app with this icon?
textedit.png

Cuz, although it complained initially about saving with a .c extension, I was certainly able to do so.
 

aStabell

macrumors member
Original poster
Jan 1, 2004
61
0
Texteditor? Is this something different from TextEdit? The app with this icon?
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
 

Attachments

  • Picture 4.png
    Picture 4.png
    438.9 KB · Views: 475

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.