You’re right, maybe the methods should have been called ReadArchive and WriteArchive. Essentially it is reading writing in a binary stream format but it’s converting the data to and from types that lisp uses, or what can be put in a result buffer.
There really isn’t an EOF, so the code is writing both an EOL and an EOF marker, so the code knows where to stop and pass the result buffer back to lisp.
Thanks for explaining the undercarriage Daniel.
Is Reading and writing in a raw byte stream, a feature you would like to have included in ODCL?
In a word yes, but don't front burner it merely for me. <Spock> The needs of the many outweigh the needs of the few -- or the one </Spock>.
Since we are using CArchive, we can use some of that class’s other methods see http://msdn2.microsoft.com/en-us/library/caz3zy5s(VS.80).aspx
I looked at said class and I don't think it would do what I'd want (tho I could be wrong). Essentially I'd like the ability to read and write binary data, probably as list of the ascii codes. While
read-char will read a file a byte at a time (including nulls), it will stop on an false eof file marker (ascii 26). Worse,
write-char won't let one write nulls, essential for binary I/O.
If one were to draft a quick signature for some of the functions (forgive me, I'm pounding this out real fast because I've only a few minutes) ...
(BinOpen filename "r" | "w" | "rw")(setq handle (BinOpen "c:\\MyData.data" "rw")) ;; opened for read and write.
(BinGet handle address [length]) ;; optional length, if nil or not present read to true eof
(setq bigStream (BinGet handle 0)) ;; get entire file.
(BinPut handle address listOfAsciiCodes) ;; address is 0 based
(BinPut handle 0 (append '(0 87 111 111 116 33) bigStream)) ;; insert 6 new values to the beginning of the file, starting with a null value (0).
Hope this makes sense.
Like I said, this is just my own wish. Before tackling something like this it's probably advisable to poll the community and see if there's enough interest to warrant the efforts.
Thanks for
your interest Daniel (and your most excellent efforts to support the OpenDCL community).