Silverfrost Forums

Welcome to our forums

Problem with Plato (C++)

10 Jul 2011 2:23 #8536

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

 #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!):

Hello World!

Press RETURN to close window ...

Can anybody help? Many thanks,

Klaus

11 Jul 2011 9:59 #8543

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;

12 Jul 2011 5:01 #8544

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.

12 Jul 2011 11:02 #8546

I have fixed this bug in salflibc.dll for the next release.

12 Jul 2011 11:31 #8547

Thank you very much, Paul.

Klaus

Please login to reply.