LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 06-21-2003, 02:24 AM   #1
fernin8r
LQ Newbie
 
Registered: Jan 2003
Posts: 27

Rep: Reputation: 15
No Output??


This is really dumb, but i'm a newbie.

here's my code. (I'm just tried to familiarize myself with the gcc compiler)

#include<math.h>
#include<stdio.h>

int main(void)
{

int a;
int b;

a = 1;
b = 2;

printf(" PLEASE");
printf("a=%2d",a);
printf("b=%2d",b);

}


HERE's what i type in

gcc ~/filename.c

i got thing to run without errors, but were do the printf statements print to? i don't see " PLEASE" or "a=1" or "b=2". am i typing something in wrong?

thanks
 
Old 06-21-2003, 04:01 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
you need a new line character, \n, to flush the output buffer for you each line.
 
Old 06-21-2003, 05:47 AM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
cd ~
gcc -o yourprog filename.c

# now you program is compiled to the "yourprog" executable.
# and you need to run that to see some output

./yourprog
 
Old 06-21-2003, 06:52 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,414

Rep: Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966Reputation: 1966
oh crap, i strike again... yeah, you only compiled the program, you didn't actually RUN it. right now you'll have a new program called a.out which is the compiled code.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
No output through SPDIf, but analog works. How do I get output through SPDIF? seanwnz Linux - General 11 11-08-2007 11:24 AM
tv output Shibby Linux - Software 1 06-07-2005 11:35 AM
Via AC'97 5.1 Optical Output or Audigy 4.1 Output Nza Fedora 3 06-01-2004 07:49 AM
the sound gives output when using mic but no output when run a music file medo Debian 0 04-19-2004 07:17 PM
Output of ls -l Crashed_Again Linux - Newbie 4 12-11-2003 06:28 PM


All times are GMT -5. The time now is 01:53 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration