ExtraTopLevelOperators.eprintf<'T> 関数 (F#)
指定された書式を使用して stderr に出力します。
名前空間/モジュール パス: Microsoft.FSharp.Core.ExtraTopLevelOperators
アセンブリ: FSharp.Core (FSharp.Core.dll)
// Signature:
eprintf : TextWriterFormat<'T> -> 'T
// Usage:
eprintf format
パラメーター
- format
型: TextWriterFormat<'T>
解説
この関数は、コンパイルされたアセンブリでは PrintFormatToError という名前です。F# 以外の言語から、またはリフレクションを使用してこの関数にアクセスする場合は、この名前を使用します。
使用例
eprintf を使用したコード例を次に示します。
let maxValue = 10
let function1 x =
if (x > maxValue) then
eprintf "Error: the input %d exceeds the maximum value, %d." x maxValue
else
printfn "Success!"
function1 1
function1 11
// Issue a newline to stderr to trigger printing.
stderr.WriteLine()
出力は次のとおりです。
プラットフォーム
Windows 8、Windows 7、Windows Server 2012 で Windows Server 2008 R2
バージョン情報
F# コア ライブラリのバージョン
サポート対象: 2.0、4.0