FileStream을 사용하는 StreamReader를 만들었습니다. StreamReader 메서드의 끝에서 Peek() 메서드를 사용하면 숫자 값 65535가 표시됩니다. char로 변환하면 마침표 '.'가 표시됩니다. VS에서 'watch'를 사용하면 EndOfStream에 도달했음을 알 수 있습니다. 65535 ('.') 값의 의미는 무엇입니까? 마침표 ('.')가 ASCII와 일치합니까?C# - 값을 보여주는 스트림 판독기 끝 65536 ('.')
'0'은 파일/스트림의 끝을 의미한다고 들었습니다.
참고 : 스트림에서 파일을 사용하는 경우 EOF와 EOS (스트림 끝) 사이에 차이가 있는지 확실하지 않습니다.
//Contains some business logic, main focus is on the while loop expression
try
{
//The peek method is used to avoid moving the Stream's position.
//If we don't encounter a number character representing the RDW, keep reading until we find one.
while (!Char.IsDigit((char)this.StreamReader.Peek()))
{
if (!this.StreamReader.EndOfStream)
this.StreamReader.Read();
else
return false;
}
//Loop completed and found the next record without encountering the end of the stream
return true;
}
catch (IOException IOex)
{
throw new Exception(String.Format("An IO Exception occured when attempting to set the start position of the record.\n\n{0}", IOex.ToString()));
}
오버플로와 같이 보이며 스트림을 읽는 방법을 게시 할 수 있습니까? –