Get the length of input_channel. (There a function for that in Stdlib) Then use
really_input_string in len |> int_of_string