I have problems writing an output file in F#. It prints an incomplete data in the output. I am not sure which part of my code is wrong or if there is any better way to do it. Below is a snapshot of the last few lines in the output file.
NKU12,201209121039,8960,8960,8960,8960
NKU12,201209121040,8960,8960,8960,8960
NKU12,201209121041,8960,8960,8960,8960
NKU12,201209121043,8960,8960,8960,8960
NKU12,201209121045,8960,8
Note that in the last line, it is incomplete. Below is my code in F#
let outFile = new StreamWriter("Test.csv")
let dataFrame = lines fileName
|> Seq.map (fun y -> y.Split([|','|]))
|> Seq.filter (fun some function)
|> Seq.iter (fun y -> outFile.WriteLine(sprintf "%s,%s,%s,%s,%s,%s" y.[0] (y.[1]+y.[2]) y.[3] y.[4] y.[5] y.[6]))
Note that in the last line, it is incomplete. If I use printfn instead of writing to a file, it will display all the information fully on the console.
Thanks Kenneth
Try to call outData.Flush or outData.Close and then check content of the file. Some data may still be in buffer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With