Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » puts() does not work as expected ...
puts() does not work as expected ... [message #882249] Wed, 06 June 2012 01:50 Go to next message
golam chowdhury is currently offline golam chowdhury
Messages: 2
Registered: June 2012
Junior Member
Hi ,

in my indigo eclipse cdt the output of the following code comes out like this -

russel
Enter boyfriend's name:
Dear russel.

You're history.


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

int main() {

	char ex[20];
	puts("Enter boyfriend's name:");	
	scanf("%s", ex);
	printf("Dear %s.\n\n\tYou're history.\n", ex);
	return 0;
}


But in cygwin it is correct like this -

adnan@adnan-PC /cygdrive/e
$ gcc test.c -o test

adnan@adnan-PC /cygdrive/e
$ ./test
Enter boyfriend's name:
Russel
Dear Russel.

        You're history.

adnan@adnan-PC /cygdrive/e
$



Please somebody advise, I am new to eclipse cdt.

Thanks in advance
Adnan

[Updated on: Wed, 06 June 2012 01:59]

Report message to a moderator

Re: puts() does not work as expected ... [message #882285 is a reply to message #882249] Wed, 06 June 2012 03:33 Go to previous messageGo to next message
Axel Mueller is currently offline Axel Mueller
Messages: 1927
Registered: July 2009
Senior Member
see http://wiki.eclipse.org/CDT/User/FAQ#Eclipse_console_does_not_show_output_on_Windows

Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: puts() does not work as expected ... [message #884970 is a reply to message #882285] Tue, 12 June 2012 03:37 Go to previous message
golam chowdhury is currently offline golam chowdhury
Messages: 2
Registered: June 2012
Junior Member
Thanks Mueller, it works. ..

(I was not notified that somebody replied, so seeing lately ...)
Previous Topic:Excluding a directory but re-including certain files?
Next Topic:VM arguments
Goto Forum:
  


Current Time: Fri Apr 18 11:59:18 EDT 2014

Powered by FUDForum. Page generated in 0.05094 seconds