|
Standard Input and Output |
Top Previous Next |
|
What is translated > File Input and Output > Standard Input and Output Delphi2CSharp provides predefined text files for console input and output.
Input represents the standard input stream and uses Console.In.
Output represents the standard output stream and uses Console.Out.
ErrOutput represents the standard error stream and uses Console.Error.
Read and ReadLn calls without a file parameter use Input:
string line = string.Empty; ReadLn(ref line);
Write and WriteLn calls without a file parameter use Output:
Write("Path: "); WriteLn(name);
These calls are internally equivalent to:
Write(Output, "Path: "); WriteLn(Output, name);
The standard console streams are not owned by the TextFile objects. Closing Input, Output, or ErrOutput must not dispose Console.In, Console.Out, or Console.Error.
Using predefined TextFile objects for console access keeps file and console formatting consistent. It also allows the standard streams to be replaced during tests. |
|
This page belongs to the Delphi2C# Documentation |
Delphi2C# home Content |