Index: trunk/ab5.0/ablib/src/Classes/System/Console.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/System/Console.ab	(revision 521)
+++ trunk/ab5.0/ablib/src/Classes/System/Console.ab	(revision 522)
@@ -11,4 +11,142 @@
 Public
 	/*
+	@brief 標準出力を設定する
+	@date 2008/06/21
+	@auther overtaker
+	*/
+	Static Sub SetOut(newOut As IO.TextWriter)
+		If ActiveBasic.IsNothing(newOut) Then
+			Throw New ArgumentNullException("newOut")
+		End If
+		out = newOut
+	End Sub
+
+	/*
+	@brief 標準出力を取得する
+	@date 2008/06/21
+	@auther overtaker
+	*/
+	Static Function Out() As IO.TextWriter
+		Out = out
+	End Function
+
+	/*
+	@brief 標準出力に1行書き込む
+	@date 2008/06/21
+	@auther overtaker
+	*/
+	Static Sub WriteLine(value As String)
+		out.WriteLine(value)
+		out.Flush()
+	End Sub
+
+	Static Sub WriteLine()
+		out.WriteLine()
+		out.Flush()
+	End Sub
+
+	Static Sub WriteLine(x As Boolean)
+		WriteLine(Str$(x))
+	End Sub
+	
+	Static Sub WriteLine(x As Char)
+		WriteLine(Chr$(x))
+	End Sub
+
+	Static Sub WriteLine(x As Byte)
+		WriteLine(Str$(x))
+	End Sub
+#ifdef UNICODE
+	Static Sub WriteLine(x As SByte)
+		WriteLine(Str$(x))
+	End Sub
+#else
+	Static Sub WriteLine(x As Word)
+		WriteLine(Str$(x))
+	End Sub
+#endif
+	Static Sub WriteLine(x As Integer)
+		WriteLine(Str$(x))
+	End Sub
+
+	Static Sub WriteLine(x As DWord)
+		WriteLine(Str$(x))
+	End Sub
+
+	Static Sub WriteLine(x As Long)
+		WriteLine(Str$(x))
+	End Sub
+
+	Static Sub WriteLine(x As QWord)
+		WriteLine(Str$(x))
+	End Sub
+
+	Static Sub WriteLine(x As Int64)
+		WriteLine(Str$(x))
+	End Sub
+
+	Static Sub WriteLine(x As Single)
+		WriteLine(Str$(x))
+	End Sub
+
+	Static Sub WriteLine(x As Double)
+		WriteLine(Str$(x))
+	End Sub
+
+	Static Sub WriteLine(x As Object)
+		WriteLine(x.ToString)
+	End Sub
+
+	/*
+	@brief 標準出力に書き込む
+	@date 2008/06/21
+	@auther overtaker
+	*/
+	Static Sub Write(s As String)
+		out.Write(s)
+		out.Flush()
+	End Sub
+
+	Static Sub Write(x As Boolean)
+		Write(Str$(x))
+	End Sub
+
+	Static Sub Write(x As Char)
+		Write(Chr$(x))
+	End Sub
+
+	Static Sub Write(x As Byte)
+		Write(Str$(x))
+	End Sub
+#ifdef UNICODE
+	Static Sub Write(x As SByte)
+		Write(Str$(x))
+	End Sub
+#else
+	Static Sub Write(x As Word)
+		Write(Str$(x))
+	End Sub
+#endif
+	Static Sub Write(x As Integer)
+		Write(Str$(x))
+	End Sub
+
+	Static Sub Write(x As DWord)
+		Write(Str$(x))
+	End Sub
+
+	Static Sub Write(x As Long)
+		Write(Str$(x))
+	End Sub
+
+	Static Sub Write(x As QWord)
+		Write(Str$(x))
+	End Sub
+
+	Static Sub Write(x As Int64)
+		Write(Str$(x))
+	End Sub
+
+	/*
 	@brief 標準入力を設定する
 	@date 2008/02/26
@@ -21,4 +159,5 @@
 		in = newIn
 	End Sub
+
 	/*
 	@brief 標準入力を取得する
@@ -47,4 +186,5 @@
 		Read = in.Read()
 	End Function
+
 Private
 	Function enter() As ActiveBasic.Windows.CriticalSectionLock
@@ -64,4 +204,5 @@
 
 	Static in = Nothing As IO.TextReader
+	Static out = Nothing As IO.TextWriter
 	Static cs = Nothing As ActiveBasic.Windows.CriticalSection
 End Class
Index: trunk/ab5.0/ablib/src/Classes/System/IO/TextWriter.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/System/IO/TextWriter.ab	(revision 521)
+++ trunk/ab5.0/ablib/src/Classes/System/IO/TextWriter.ab	(revision 522)
@@ -176,4 +176,8 @@
 	End Function
 
+	Static Function Synchronized(reader As TextWriter) As TextWriter
+		' TODO: 実装。とりあえずそのまま返却
+		Return reader
+	End Function
 Protected
 	Virtual Sub Dispose(disposing As Boolean)
@@ -184,4 +188,5 @@
 End Class
 
+
 End Namespace
 End Namespace
Index: trunk/ab5.0/ablib/src/basic/dos_console.sbp
===================================================================
--- trunk/ab5.0/ablib/src/basic/dos_console.sbp	(revision 521)
+++ trunk/ab5.0/ablib/src/basic/dos_console.sbp	(revision 522)
@@ -9,4 +9,7 @@
 Dim _System_hConsoleOut = GetStdHandle(STD_OUTPUT_HANDLE)
 Dim _System_hConsoleIn = GetStdHandle(STD_INPUT_HANDLE)
+System.Console.SetOut(
+	 System.IO.TextWriter.Synchronized(New System.IO.StreamWriter(
+		New System.IO.FileStream(_System_hConsoleOut, System.IO.FileAccess.Write, False))))
 System.Console.SetIn(
 	System.IO.TextReader.Synchronized(New System.IO.StreamReader(
@@ -57,5 +60,6 @@
 
 	Dim dwAccessBytes As DWord
-	WriteConsole(_System_hConsoleOut, buf.StrPtr, buf.Length, dwAccessBytes, 0)
+	System.Console.Write(buf)
+'	WriteConsole(_System_hConsoleOut, buf.StrPtr, buf.Length, dwAccessBytes, 0)
 End Sub
 /* TODO: _System_GetUsingFormatを用意して実装する
