Submission streams

Every program during runtime consumes and produces data in streams.

Standard input (stdin)

This stream contains data that is forwarded to the program as input data. With Sphere Engine Compilers, it's possible to specify the contents of this stream individually for each program execution. With Sphere Engine Problems, this stream is used to deliver input data from a test case. In both cases, the program can read the data.

For example, in C++, input data can be retrieved using the cin stream, which is a part of the iostream library.

#include <iostream>
using namespace std;

int main() {
    int number;
    cin >> number;
    // the "number" variable  contains a number given in input data
    return 0;
}

Important: The stdin stream and command-line arguments are two different methods of passing data to the program. All Sphere Engine components use stdin stream for passing input data. No additional parameters are added to the command-line arguments list.

Standard output (stdout)

This stream contains output data which the program produces during execution. In both Compilers and Problems modules, it's possible to present output data to the end-user after the program is executed. However, in Sphere Engine Problems, output data is usually hidden to ensure secrecy of the test cases. In such an event, the output data is used during the correctness verification process, but the end-user has no access to it.

For example, in C++, data can be printed using the cout stream, which is a part of the iostream library.

#include <iostream>
using namespace std;

int main() {
    cout << "This message will be present in the standard output stream";
    return 0;
}

Standard error (stderr)

This stream contains error messages generated by the program during execution. Error information may be presented to the end-user after the program execution has completed. Also, similarly to the output data in the Problems module, the common approach is to keep the content of this stream (at least partially) secret to protect test cases' data.

This stream can also be used for printing debug messages without the risk of mixing them with output data written to the stdout stream.

For example, in C++, data can be printed to the error stream using the cerr stream, which is a part of the iostream library.

#include <iostream>
using namespace std;

int main() {
    cerr << "This message will be present in the standard error stream";
    return 0;
}

Compilation info (cmpinfo)

This stream contains information about errors and warnings which appeared during the compilation of the program.

Note: The program compilation information is included only for compiled languages ​​(e.g., C, C ++, Java, Python). For interpreted languages ​​(e.g., PHP, Perl), data about the parsing process and the interpretation of the source code (e.g., information about syntax errors) can be found in the stderr stream.

The following example presents the error that appeared during the compilation of a simple C++ program:

prog.cpp: In function ‘int main()’:
prog.cpp:5:9: error: ‘number’ was not declared in this scope
  cin >> number;
         ^~~~~~