ocaml - stop reading file when marker is reached -


i have following code, basics of i'm trying do:

let ic = open_in "file.txt" in try   while true     let line = input_line ic in     print_endline line   done end_of_file -> close_in ic 

what want read file in string appending each line until reach word "stop_here" tried few ways of own , got totally messed up.. on windows os.

thanks help

inside while loop, add test if line = "stop_here" raise end_of_file?

refine if want stop on line contains marker.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -