gcc newbie

Newbie qn:
I’ve tried the “Hello world”…
typed gcc -o hello hello.c
and got the hello file
then what ? how can I see my “hello world” ?

Dzulbokhari

type ./hello

dzm wrote in message <39FD0712.EA579A6F@tm.net.my>…

Newbie qn:
I’ve tried the “Hello world”…
typed gcc -o hello hello.c
and got the hello file
then what ? how can I see my “hello world” ?

Dzulbokhari

thanks

Dzulbokhari

Jim Atkins wrote:

type ./hello

dzm wrote in message <> 39FD0712.EA579A6F@tm.net.my> >…
Newbie qn:
I’ve tried the “Hello world”…
typed gcc -o hello hello.c
and got the hello file
then what ? how can I see my “hello world” ?

Dzulbokhari

You can do “vi hello.c” to edit it?
Or “cat hello.c” to display it.
If you want to run it: “./hello”

(./ is just a short cut for the full path to
your hello program. It’s the same as saying
“/home/ted/hello” if your program was in /home/ted"
The reason for having to supply a full path?
“.” is not in the default path, due to good
reasons recently explained in a thread in
one of these newsgroups…)

dzm wrote:

Newbie qn:
I’ve tried the “Hello world”…
typed gcc -o hello hello.c
and got the hello file
then what ? how can I see my “hello world” ?

Thanks for the info on what ./ (dot-slash in qnx, not slash-dot … :sunglasses:
means. No wonder I couldnt run the hello exe file when I typed hello (or
a.out). I had thought that when I’m in the same dir as the file is, I
need not type the full path.

Dzulbokhari

Alex Cellarius wrote:

You can do “vi hello.c” to edit it?
Or “cat hello.c” to display it.
If you want to run it: “./hello”

(./ is just a short cut for the full path to
your hello program. It’s the same as saying
“/home/ted/hello” if your program was in /home/ted"
The reason for having to supply a full path?
“.” is not in the default path, due to good
reasons recently explained in a thread in
one of these newsgroups…)

dzm wrote:

Newbie qn:
I’ve tried the “Hello world”…
typed gcc -o hello hello.c
and got the hello file
then what ? how can I see my “hello world” ?

You can change this default behavior.

Just append the follwing line to your .profile in your home directory :
PATH=$PATH:.

Contrary to MS-DOS/Win95/NT, on Un*x systems the current directory must be
explicitely added to the PATH variable.

Dolmen

“dzm” <dzm@tm.net.my> a écrit dans le message news:
3A000C2C.B04ED271@tm.net.my

Thanks for the info on what ./ (dot-slash in qnx, not slash-dot … > :sunglasses:
means. No wonder I couldnt run the hello exe file when I typed hello (or
a.out). I had thought that when I’m in the same dir as the file is, I
need not type the full path.

Dzulbokhari

Thanks for the tip.

Dzulbokhari

“Olivier Mengué” wrote:

You can change this default behavior.

Just append the follwing line to your .profile in your home directory :
PATH=$PATH:.

Contrary to MS-DOS/Win95/NT, on Un*x systems the current directory must be
explicitely added to the PATH variable.

Dolmen

“dzm” <> dzm@tm.net.my> > a écrit dans le message news:
3A000C2C.B04ED271@tm.net.my> …
Thanks for the info on what ./ (dot-slash in qnx, not slash-dot … > :sunglasses:
means. No wonder I couldnt run the hello exe file when I typed hello (or
a.out). I had thought that when I’m in the same dir as the file is, I
need not type the full path.

Dzulbokhari