어떻게 스트림 데이터는 바이너리를 표준출력합니다.NET?

StackOverflow https://stackoverflow.com/questions/111387

  •  02-07-2019
  •  | 
  •  

문제

내가 하려고 스트림 데이터는 바이너리를 표준출력합니다.NET.그러나만 기록할 수 있습 char 콘솔을 사용하여 클래스입니다.나는 그것을 사용하고 싶다는 것을 리디렉션.는 방법이 있을까요?

도움이 되었습니까?

해결책

당신은에 액세스할 수 있는 출력 스트림을 사용하여 Console.OpenStandardOutput.

    static void Main(string[] args) {
        MemoryStream data = new MemoryStream(Encoding.UTF8.GetBytes("Some data"));
        using (Stream console = Console.OpenStandardOutput()) {
            data.CopyTo(console);
        }
    }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top