Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Reading from a stream until '\000' - will this approach work?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-09-13 (18:27)
From: Richard <rich@l...>
Subject: [Caml-list] Reading from a stream until '\000' - will this approach work?
After thinking a bit more about it...

(* Please read disclaimer comments first :)  *)

How about -

(*I'm not sure what the name of the method to read in just one 
character is... 'read_char' ??*)
(*I'm also not sure how to tack that character from the stream onto an 
ever growing string... '^' ?? *)
(*I still need to read about how to break out of a loop... 'break' ??*)

let rec myStreamReader inchan =
   let char = read_char inchan in
   if char = '\000' then
      let holderString = holderString ^ char
      and break
      myStreamReader inchan

Again - I hope I'm able to make sense...

Thanks for any feedback on the concept!
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: