LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   programming in c (https://www.linuxquestions.org/questions/linux-newbie-8/programming-in-c-898935/)

ohmsray 08-23-2011 07:33 AM

programming in c
 
please advice on how to use the terminal to program in the c language.

markush 08-23-2011 07:55 AM

Hello ohmsray, welcome to LQ,

in the terminal you will need an editor, for example vi or emacs. You write the sourcecode with the editor. Compiling is done on the commandline. For example, if you have progamcode called hello.c you may execute
Code:

gcc -o hello hello.c
the outputfile will be "hello" and can be executed with
Code:

./hello
in Linux other than Windows you'll have to use the path to the programm even it is in your current working directory.

It would be helpful if you explain what you want to do.

Markus

MTK358 08-23-2011 04:57 PM

Note that vi and Emacs are not like most editors, you can't just start typing like in a normal GUI editor. If you want something simpler, try nano. But if you're going to do a lot of editing, I would recommand that you learn vi or Emacs.

ohmsray 08-24-2011 04:24 AM

thanks
 
i appreciate your responses alot thanks once again,my problem is that am not familiar enough with using the editors.guys if you dont mind would you please advice or atleast help me on it or give me a tutorial on how to use emacs,vi,and nano.

markush 08-24-2011 05:32 AM

Well, assuming you have vim already installed. Check that you have a file .vimrc in your home-directory, if not copy the file /usr/share/vim/vim73/vimrc.sample.vim as .vimrc into your home-directory.

vim is a modern clone of the standard-Unix-editor vi.

vim comes with a tutorial, simply execute "vimtutor" on the commandline.

At first sight vim is a little difficult to use, but the best choice when one uses no gui at all. Once you are familiar with vim you'll never use another editor. It is the fastest and most convenient way to edit files. I've installed vim on all my Windows-servers.

Markus

0men 08-24-2011 05:51 AM

Hey,

Well you can use Vi or Nano. Nano is more user friendly, but if you willing to learn a little bit than i agree with marcush, that is, Vi is a lot better for editing. If you want a non-terminal editing program, Kate is awesome for any KDE system, and i dont mind Gedit (after a little bit of customizing) for gnome.

The first look at Vi, its a little difficult to grasp, but once you know it thats all you'll use :)
Jump onto youtube and have a look, they have some pretty good tutorials on how to use editors.

If your after programming tutorials, "thenewboston" <<---- (his channel on youtube) has easy to understand beginner tutorials.

Good Luck !

MTK358 08-24-2011 07:32 AM

No learning is necessary for nano. Just open it up and start typing. It even has a keyboard shortcut reference at the bottom of the screen.

For Vim, try running the "vimtutor" command. There are also many vi and Vim tutorials on the Internet.

ohmsray 08-27-2011 05:36 AM

grattyud
 
guys thanks alot

momok 08-21-2012 05:35 PM

you can also use scite if you want as an alternative or blue-fish


All times are GMT -5. The time now is 08:31 PM.