Visit Our UNIX and Linux User Community


Help Please


 
Thread Tools Search this Thread
Top Forums Programming Help Please
# 1  
Old 01-27-2008
Help Please

Ok firstly i must say that i have just switched to Ubuntu and Linux, so im a real newbie!!!
Next is that im trying to learn C, so i got an IDE called Geany.
Im following this tutorial on c and all is fine on the first example, i created the code, compiled, linked and get my EXE.
Now here comes my question.
How can i make use of this exe in Ubuntu? In other words, when i start following the exercises and wich to see them running in Ubuntu has a proper app, what file ext or how? Many thanks and please excuse the ignorance.
Im very eager to learn C and hopeffully start creating some software for Linux, am i on the right language?
# 2  
Old 01-28-2008
Have I heard "newbie"?
Please, don't feel uncomfortable with this: from what I've read (posts and replies), almost everybody here can be considered as a newbie...

I guess that most of your preceeding experience with programming has taken place on a Windows platform (the EXE, file extension, ...).

Basically (as you might know), filesystems of distinct platforms might be very different.
Remember you're entering a different area with Linux; concerning your request,
I will say "the file extension 'concept' has been trashed for this platform!".

On Linux (or Unix), a file (or a directory) is restricted to a limited number of people (you, the members of your group and the others);
in addition, this is applied for the 3 following kinds of privilege:
. read,
. write,
. execute.

Let's take a example...
Suppose you are into a directory named '/private_data/test', within which
you have stored 3 files:
. readme.txt, (some documentation)
. test.c, (a C source file)
. test (the resulting binary)

me@my_machine> # Where am I?
me@my_machine> pwd
/

me@my_machine> # Go to the test directory
cd /private_data/test

me@my_machine> # What is the content of this directory?
me@my_machine> ls -l
total 14
-rw-r--r-- 1 me my_group 18933 Jan 27 20:16 readme.txt
-rw-r--r-- 1 me my_group 3393 Jan 20 12:00 test.c
-rwxr-xr-- 1 me my_group 24938 Jan 28 15:03 test

Meaning of the '-rwx...':
r (Read) privilege
w (Write) privilege
x (eXecute) privilege
-rwxr-xr-- 1 me my_group 24938 Jan 28 15:03 test
... # 'u': for you, the current User ('me')
... # 'g': for the Group you belong to ('my_group')
... # 'o': the Others

For the '-rwxr--r-- 1 me my_group 24938 Jan 28 15:03 test' item, this means:
. you own the 'test' file,
. you have RWX privileges on it,
. your group has RX privileges on it,
. the others have only R privilege on it,

You can for instance change the privilege of a specific file by using the 'chmod' command:
me@my_machine> chmod o-r test.c # or chmod 640 test.c
me@my_machine> ls -l
-rw-r--r-- 1 me my_group 18933 Jan 27 20:16 readme.txt
-rw-r----- 1 me my_group 3393 Jan 20 12:00 test.c
-rwxr-xr-- 1 me my_group 24938 Jan 28 15:03 test
me@my_machine> # The people outside of your group cannot read anymore the test.c file!

I guess you should know now how to make a file executable (the answer is 'chmod u+x my_file' of course).


Hope it helps,
C.

Previous Thread | Next Thread
Test Your Knowledge in Computers #994
Difficulty: Medium
A hypervisor or virtual machine monitor (VMM) is a computer software, firmware or hardware that creates and runs virtual machines.
True or False?

Featured Tech Videos