我想打印文件的内容。我试图使用字符串缓冲区:从文件内容打印字符串缓冲区
let ch = open_in "myfile.txt" in
let buf = Buffer.create 1024 in
(try Buffer.add_channel buf ch max_int with _ ->());
close_in ch;
let string = Buffer.contents buf
print_endline string
这只是给我一个语法错误。
我该怎么做?
例如这里你似乎也不在乎你得到答案。如果你想让人们花时间回答你的问题,你需要付出一些努力,否则他们不会。 – Thomas 2013-04-07 10:54:12