Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Setting the EOL character....
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Lyman <rich@l...>
Subject: [Caml-list] Setting the EOL character....
To start - I really don't know that much about programming (3 years self-taught in scripted web languages - Perl/PHP/Ruby), and I'm trying to learn OCaml...

I've mostly dealt with persistent socket servers in other programming languages, and I'd like to write one in OCaml.

I've read most of the book - Developing Applications with Objective Caml (English PDF), so I understand a little - but I'm still very unsure of myself.

Here's the problem I'm trying to solve...

I have a proprietary format I'm trying to read in through a socket - when I say proprietary I mean that the EOL character is the ASCII null character (\000) and not the '\n' character.

I've looked at the examples in the OReilly book, but I'm not sure how to change the default End Of Line character (\n) to \000.

Will I have to do some sort of pattern match on the stream so that I can deal with 'each line' using \000 as the EOL character?

Do the input, input_line, read, or read_line methods accept a different EOL character as a parameter - or can I define the method differently?

Since I can read in a certain amount of characters with methods like read, can I find the location of the ASCII null character and read from the stream until right after it?

I hope I've asked good enough questions...

Thanks for any help you guys can give!

Let me know if anything's not clear enough...

-Rich