简体   繁体   中英

What is standard input and output?

I'm starting to work on a chess engine and I want to follow the uci interface where comunication is done using plane text. In the specification it says

all communication is done via standard input and output with text commands

but I dont know what this means in real terms.

I'm thinking of writing in C# as a .net standard library. I understand that as uci is cross platform we cannot talk in language like Console.WriteLine but what does that line in the api mean for me.

Do I have to run a loop listening for Console.ReadLine() or something similar for standard input? I just don't get it. Or should I be writing a console application that takes the input as a command line argument, and writes string to the console?

The full specification can be downloaded from this link: http://download.shredderchess.com/div/uci.zip

Any process have three default streams:

  • Standard input (stdin): This is the only input stream for all terminal or console aps. When you cal Console.ReadLine or Console.Read the result is taken from this stream.
  • Standard Output (stdout): When you call output-related commands in the console singleton class, all data goes here. For example the WriteLine or theWrite methods. The color and beeps commands send data to there too.
  • Standard error (stderr): This is a dedicated stream to print error-related content to the console. This is dedicated because some applications and scripting solutions want to hide these messages.

You can communicate with the containing process (such a console prompt) with these streams. The command line arguments can be passed only to the program's main method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM