Machine.E suggestion. Was: Re: Jiri Fonts; Zero length...
- Posted by "Carl R. White" <C.R.White at SCM.BRAD.AC.UK> Nov 03, 1998
- 623 views
On Sat, 31 Oct 1998, Robert Craig wrote: > Ralf writes: > > [Zero Length Terminator] > > I'm shocked. RDS fix this for the next release, if you are not > > planning on providing a patch. Take for example EDOM. > > I just found one of the reasons of the mysterious crashes. > > I sometimes have a lot of zero's in the sequence I puts to the file. > > Try opening a file for write-binary "wb", (or even write "w"). > The zeros will be written out just as you expect. Reading this message reminded me of something. A little experimentation with my file SPLITter revealed that Euphoria automatically buffers 8192 bytes (8k) before even thinking about accessing disk. The most recent version of SPLIT implements its own buffering, but Euphoria's 8k is still being used. Would it be possible to add a function or procedure somewhere in the language (machine.e is a good place, hence subject) that alters Euphoria's buffer size. Example Manual segment: -------------------------------<set_buffer>------------------------------ Platform: Should work in both really... Syntax: include machine.e i2 = set_buffer(i1) Description: Sets the size of the input/output buffer(s). The buffer fills on a read, or doesn't write until the buffer is full, depending on the current operation. Returns the new buffer size. Comments: If i1 = 0, the current buffer size is returned. No changes. If i1 <= 8192 (8 Kb) then the buffer size is set to 8192. This is the lower limit. 8192 is returned. If setting to i1 would use up too much memory, 0 is returned. If there are files in operation (!) -1 is returned. Example: size = set_buffer(size) if size = -1 then puts(2, "Files are open!") elsif not size then puts(2, "Buffers unchanged!") else printf(1, "Buffers are now at %1.2gKb.", {size/1024}) end if See Also: open, close, ?allocate? --------------------------------------------------------------------------- -- Carl R White -- Final Year Computer Science at the University of Bradford E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :) URL......: http://www.bigfoot.com/~cyrek/ Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr -- B.Q.Vgesa