View previous topic :: View next topic |
Author |
Message |
KL
Joined: 16 Nov 2009 Posts: 155
|
Posted: Sun Jul 10, 2011 3:23 pm Post subject: Problem with Plato (C++) |
|
|
I have tried to run some beginners C++ programs with Plato (latest build). All tests ran successfully with Visual C++ Express 2010. However, when I run the programs employing Plato, I get always only one line of output. For instance
Code: |
#include <iostream.h>
int main()
{
cout << "Hello World!\n";
cout << "Hello World!\n";
cout << "Hello World!\n";
cout << "Hello World!\n";
cout << "Hello World!\n";
return 0;
}
|
gives (only one Hello World!):
Code: |
Hello World!
Press RETURN to close window ...
|
Can anybody help? Many thanks,
Klaus |
|
Back to top |
|
 |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Mon Jul 11, 2011 10:59 pm Post subject: |
|
|
It looks like it is outputting all the lines, just they are on top of each other.
In Windows you may need to use the following to ensure a "LF" linefeed is output as well as a "CR" carriage return.
cout << "Hello World!\r\n";
or use the following, which is better.
cout << "Hello World!" << endl; _________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8208 Location: Salford, UK
|
Posted: Tue Jul 12, 2011 6:01 am Post subject: |
|
|
This looks to me like a bug in the ostream library (within salflibc.dll).
A fail flag is being set after the endl and this causes subsequent output to be lost.
I am working on a fix. |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8208 Location: Salford, UK
|
Posted: Tue Jul 12, 2011 12:02 pm Post subject: |
|
|
I have fixed this bug in salflibc.dll for the next release. |
|
Back to top |
|
 |
KL
Joined: 16 Nov 2009 Posts: 155
|
Posted: Tue Jul 12, 2011 12:31 pm Post subject: |
|
|
Thank you very much, Paul.
Klaus |
|
Back to top |
|
 |
|