Please enable JavaScript.
Coggle requires JavaScript to display documents.
Managing Input/Output - Coggle Diagram
Managing Input/Output
Systen.IO Streams
File.OpenRead - Opens file for reading
File.Open - Opens file for writing with a following mode
FileMode.Create - Opens file and overwrites file if it already exists
FileMode.CreateNew - Opens file and throws exception if it already exists
FileMode.Append - Opens file and moves to the end for writing
StreamReader and StreamWriter transfer character based data to/from text files
BinaryFormatter allows transfer of serializable data as a simple binary data stream
Types of Input/Output
User Input - via keyboard or mouse, GUI controls such as buttons or TextBox etc, this is how the user interacts with the system and inputs their data. This requires validation to combat any human error and check the input is correct
Console I/O - The console can be used for basic input and output through the use of Console.ReadLine(); and Console.WriteLine(); This outputs information in the console and reads the user,s inputted response when prompted.
Graphical Output - Graphical output is done via List Views, Message Boxes and Labels etc, displaying tables of information that can be filtered and searched in for information, provides a formatted output for good visibility and user satisfaction.
File Input/Output - This includes reading and writing from text or binary files, some common ways to do this in c# is StreamWriter, StreamReader, BinaryReader or BinaryWriter. An example of this could be reading a score and username from a binary file to display on a leaderboard or writing a new users registered username and password to the users file so they can log in with the same account at a later date
What is input/output
In software systems, input refers to any data received by the program (from users, files, sensors, etc.), and output is the data produced or displayed (to screens, files, printers, etc.).
In OOP, managing Input and output involves:
Reading and writing data using objects and methods
Ensuring data is validated, formatted, and stored correctly
Handling errors gracefully (e.g. file not found, invalid input