caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Reading from a stream until '\000' - will this approach work?
@ 2002-09-13 18:25 Richard
  2002-09-15 17:28 ` Alessandro Baretta
  0 siblings, 1 reply; 2+ messages in thread
From: Richard @ 2002-09-13 18:25 UTC (permalink / raw)
  To: caml-list

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
   else
      myStreamReader inchan
;;

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

Thanks for any feedback on the concept!
-Richard
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-09-15 17:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-13 18:25 [Caml-list] Reading from a stream until '\000' - will this approach work? Richard
2002-09-15 17:28 ` Alessandro Baretta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).