This project is read-only.
Read Entire File, .NET-style

Category:
Input/Output
Description: Read an entire text file as a string using .NET I/O utilities and abstractions.
Code:
let EntireFileInputSample2() = 

// Write a test file
System.IO.File.WriteAllLines(@"test.txt", [| "This is a test file.";
"It is easy to read." |]);
// Now read it
let res = System.IO.File.ReadAllText(@"test.txt")
printfn "%s" res


Execution Result:
This is a test file.
It is easy to read.


Last edited Sep 14, 2011 at 3:41 AM by ttliu2000, version 1

Comments

No comments yet.