Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Problem with eclipse and a simple c program

Reply
Thread Tools

Problem with eclipse and a simple c program

 
 
lionelgreenstreet@gmail.com
Guest
Posts: n/a
 
      12-12-2007
I have some problems when this simple program run with eclipse:

#include <stdio.h>
#include <stdlib.h>



int main()
{
int number;
printf("Enter a number\n");
scanf("%d", &number);
printf("You entered %d", number);
return 0;
}

In run mode on consolle nothing appear, "enter a number" appears only
after the inserction of a number and not before. Why?
Thanks
 
Reply With Quote
 
 
 
 
jacob navia
Guest
Posts: n/a
 
      12-12-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I have some problems when this simple program run with eclipse:
>
> #include <stdio.h>
> #include <stdlib.h>
>
>
>
> int main()
> {
> int number;
> printf("Enter a number\n");
> scanf("%d", &number);
> printf("You entered %d", number);
> return 0;
> }
>
> In run mode on consolle nothing appear, "enter a number" appears only
> after the inserction of a number and not before. Why?
> Thanks


When I run this from a console it works correctly here
(windows vista 64/ lcc-win compiler)

Maybe in some systems you have to write
fflush(stdout);
after the printf statement. Try that.


--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
 
Reply With Quote
 
 
 
 
Eric Sosman
Guest
Posts: n/a
 
      12-12-2007
(E-Mail Removed) wrote:
> I have some problems when this simple program run with eclipse:
>
> #include <stdio.h>
> #include <stdlib.h>
>
>
>
> int main()
> {
> int number;
> printf("Enter a number\n");
> scanf("%d", &number);
> printf("You entered %d", number);
> return 0;
> }
>
> In run mode on consolle nothing appear, "enter a number" appears only
> after the inserction of a number and not before. Why?


This is Question 12.4 in the comp.lang.c Frequently
Asked Questions (FAQ) list at <http://www.c-faq.com/>.

--
Eric Sosman
(E-Mail Removed)lid
 
Reply With Quote
 
pete
Guest
Posts: n/a
 
      12-12-2007
(E-Mail Removed) wrote:
>
> I have some problems when this simple program run with eclipse:
>
> #include <stdio.h>
> #include <stdlib.h>
>
> int main()
> {
> int number;
> printf("Enter a number\n");
> scanf("%d", &number);
> printf("You entered %d", number);

printf("You entered %d\n", number);

> return 0;
> }
>
> In run mode on consolle nothing appear, "enter a number" appears only
> after the inserction of a number and not before. Why?


The last text line of a text stream may need to be newline terminated.
For portable C programming,
the last text line of a text stream should be newline terminated.

N869
7.19.2 Streams

[#2] A text stream is an ordered sequence of characters
composed into lines, each line consisting of zero or more
characters plus a terminating new-line character. Whether
the last line requires a terminating new-line character is
implementation-defined.

--
pete
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple program with a simple(?) error -- what's wrong? RichardOnRails Ruby 3 07-21-2008 01:26 PM
Eclipse and CVS, Eclipse wipes out CVS directories xyzzy12@hotmail.com Java 1 08-31-2007 10:19 AM
Simple simple program error...please help tasheeta@gmail.com C++ 14 11-02-2005 12:52 PM
Deploying eclipse plugin cleared everything in eclipse - project references in package explorer etc. javaguy44 Java 1 08-18-2004 03:24 PM
A few simple problems in a simple program. jmac@berkeley.edu C Programming 7 07-23-2003 09:51 PM



Advertisments