Both write () and writeline () are system. the methods provided by the console are mainly used to display the output stream by the specified output device (the screen by default. the difference between the two lies in the console. the writeline () method outputs the string to be output along with the line feed control character. When the statement is executed, the cursor moves to the next line of the current output string. as for console. in the write () method, the cursor stops at the last character of the output string and does not move to the next line.
For example, console. writeline ("A"); console. writeline ("B") will output a B in two rows and console. write ("A"); console. write ("B") Outputs a B in the same row.
Stream and byte reading problems:
Mmstream. Read (Byte[] Buffer, offset, count)
Among them, mmstream is a stream object of the memorystream class. Among the three parameters, buffer contains the specified byte array, which ranges from offset to (Offset + count-1) the value is replaced by the characters read in the current stream. Offset refers to the byte offset in the buffer, which is read from this point. Count refers to the maximum number of bytes read. The write () method and read () method have the same parameter type.
2,
What is the difference between memorystream. Position and memorystream. Seek?
Both of them obtain or set the current position in the stream. It seems that the seek function completely covers the position function. What should postion do?
------ Solution ----------------------
No!
I asked u, if you do not know the file stream length, or you do not care about the file stream length, you only need to take the Fifth byte to the last. How do you specify the position? The seek method and seekorigin enumeration are required. Besides, position is also responsible for obtaining the current position. 3. C # stream reading (conversion)
A stream has three basic operations: writing, reading, and searching.
If data is transmitted from the memory buffer to the external source, such a stream is called "Write stream ".
If data is transmitted from an external source to the memory buffer, such a stream is called "read stream ".
// Initialize a cache Zone
byte
[] buffer =
new
byte
[BufferLen];
int
read = 0;
int
block;
C # What is the difference between console. Write and console. writeline ????