LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-15-2003, 02:06 AM   #1
franki_boy
LQ Newbie
 
Registered: Feb 2003
Posts: 17

Rep: Reputation: 0
help


hey guys,
e i have only recently installed red hat 8.0
and i tried 2 run a c program on it it compiles fine but doenst show any o/p i did the following logged on as root
it shows [root@localuser...]#
and then i did vi new.c
wrote the program
did esc :wq to come out
snd tired to exec it
i did
# gcc new.c -o new
i also tried
#gcc new.c
the program complies but when i type
#./a.out
or#./new it doesnt show me any o/p
could u pls help me
i would really be grateful
thanx
 
Old 02-15-2003, 02:09 AM   #2
Palin
Member
 
Registered: Feb 2003
Location: A Meatlocker, well feels like one
Distribution: Gentoo
Posts: 292

Rep: Reputation: 30
the only thing I can think of is permissions do you know what they are set to for that file?
 
Old 02-15-2003, 02:28 AM   #3
franki_boy
LQ Newbie
 
Registered: Feb 2003
Posts: 17

Original Poster
Rep: Reputation: 0
what permissions r u talking about i logged on as root
and just created the file so wat permissions???
 
Old 02-15-2003, 02:46 AM   #4
Palin
Member
 
Registered: Feb 2003
Location: A Meatlocker, well feels like one
Distribution: Gentoo
Posts: 292

Rep: Reputation: 30
if you type ls -l in that directory it will list the file permissions

basically i was wondering if the file was allowed to execute on your machine.
 
Old 02-15-2003, 03:23 AM   #5
moeminhtun
Member
 
Registered: Dec 2002
Location: Singapore
Distribution: Fedora Core 6
Posts: 647

Rep: Reputation: 30
can you paste your program here?
 
Old 02-15-2003, 06:26 AM   #6
franki_boy
LQ Newbie
 
Registered: Feb 2003
Posts: 17

Original Poster
Rep: Reputation: 0
its a simple hello world program
#include<stdio.h>
main()
{
printf("hello world");
}
there we go
thats it
now can u help me out??
 
Old 02-15-2003, 06:40 AM   #7
moeminhtun
Member
 
Registered: Dec 2002
Location: Singapore
Distribution: Fedora Core 6
Posts: 647

Rep: Reputation: 30
Ok.
put the "\n" at the end of the line.

like this.

printf("hello world\n");
 
Old 02-15-2003, 06:59 AM   #8
franki_boy
LQ Newbie
 
Registered: Feb 2003
Posts: 17

Original Poster
Rep: Reputation: 0
hi again,
this is what the ls- l o/p shows me
rwxr-xr-x 1 root root 11352 Feb 15 14:53 new
 
Old 02-15-2003, 07:19 AM   #9
moeminhtun
Member
 
Registered: Dec 2002
Location: Singapore
Distribution: Fedora Core 6
Posts: 647

Rep: Reputation: 30
Have you put "\n"?
 
Old 02-15-2003, 07:38 AM   #10
franki_boy
LQ Newbie
 
Registered: Feb 2003
Posts: 17

Original Poster
Rep: Reputation: 0
hey moe,
thankx a lot man.the /n thing really worked,but could u tell me why do i
need to actually enter \n i mean it should work without it shouldnt it??
anyways i have another problem nowmi downloaded xine vcd player(xine-ui-0.9.18cvs-030215.i586.rpm)
and also curl-7.10.3-1.i386.rpm installed it on red hat8.0 and when i type
xine in the console it opens up but after a few minutes my m/c logs out and
got to the text logon screen and then the gui screen does anyone know why this happens???
 
Old 02-15-2003, 08:55 AM   #11
lackluster
Member
 
Registered: Apr 2002
Location: D.C - USA
Distribution: slackware-current
Posts: 488

Rep: Reputation: 30
m4yb3 u shuld g0 b4ck 2 w1nd0wz
 
Old 02-15-2003, 10:51 AM   #12
moeminhtun
Member
 
Registered: Dec 2002
Location: Singapore
Distribution: Fedora Core 6
Posts: 647

Rep: Reputation: 30
Quote:
Originally posted by franki_boy
hey moe,
thankx a lot man.the /n thing really worked,but could u tell me why do i
need to actually enter \n i mean it should work without it shouldnt it??
Actually it does print without "\n", but when the program exit, the command prompt overwrite the printed line so you can't see it. So you have to append "\n" and give the new line command so that you get back to command prompt only after the printed line. Make sense right?
But in windows, it is not the case I think.

Last edited by moeminhtun; 02-15-2003 at 11:07 AM.
 
Old 02-15-2003, 10:56 AM   #13
moeminhtun
Member
 
Registered: Dec 2002
Location: Singapore
Distribution: Fedora Core 6
Posts: 647

Rep: Reputation: 30
Quote:
Originally posted by franki_boy
hey moe,

anyways i have another problem nowmi downloaded xine vcd player(xine-ui-0.9.18cvs-030215.i586.rpm)
and also curl-7.10.3-1.i386.rpm installed it on red hat8.0 and when i type
xine in the console it opens up but after a few minutes my m/c logs out and
got to the text logon screen and then the gui screen does anyone know why this happens???
hmm.. I don't know much in that area. I think you should ask this in the Linux-general or Software forum so that you can get the answer faster. Only the programming guys are coming to this forum.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration