Skip to main content


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 05:50 Go to next message
golam chowdhury is currently offline golam chowdhuryFriend
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 05: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 07:33 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
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 07:37 Go to previous message
golam chowdhury is currently offline golam chowdhuryFriend
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: Tue Apr 23 12:48:11 GMT 2024

Powered by FUDForum. Page generated in 0.03363 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top