다음을 통해 공유


ExtraTopLevelOperators.fprintf<'T> 함수(F#)

fprintf 기능은 지정된 형식을 사용하여 파일로 출력합니다.

네임스페이스/모듈 경로: Microsoft.FSharp.Core.ExtraTopLevelOperators

어셈블리: FSharp.Core(FSharp.Core.dll)

// Signature:
fprintf : TextWriter -> TextWriterFormat<'T> -> 'T

// Usage:
fprintf textWriter format

매개 변수

설명

컴파일된 어셈블리에서 이 함수의 이름은 PrintFormatToTextWriter입니다. F# 이외의 언어에서 함수에 액세스하거나 리플렉션을 통해 함수에 액세스하는 경우 이 이름을 사용합니다.

예제

다음 예제는 fprintf의 사용을 보여 줍니다.

let printNumbersToFile fileName n =
   // "use" will cause the file to be closed when it
   // goes out of scope. 
   use file = System.IO.File.CreateText(fileName)
   [ 1 .. n ]
   |> List.iter (fun elem -> fprintf file "%d " elem)
   fprintfn file ""
printNumbersToFile "1to100.txt" 100

결과 파일 1to100.txt에는 다음 데이터가 포함되어 있습니다.

  

플랫폼

Windows Windows 서버 2012, Windows Server 2008 R2, Windows 7, 8

버전 정보

F# 코어 라이브러리 버전

지원: 2.0, 4.0, 노트북

참고 항목

참조

Core.ExtraTopLevelOperators 모듈(F#)

Microsoft.FSharp.Core 네임스페이스(F#)