www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.stream.File fix

I rewrote this class to fix the following:

1) open() and constructor will now create the file if the file doesn't exist
and only if mode FileMode.Out is specified.
2) Linux error codes were being returned as sizes instead of being handled.
3) Files are now being shared for read and write on Windows, like fopen().

This attached code is donated to the origional author of stream.d and can
have the same license. I'm going to be fixing up parts of phobos for awhile
now and if the changes aren't added, I'll release my own library.

--
Christopher E. Miller


begin 666 filestream.txt

M;C,R*0T*"7L-" D):6UP;W)T('-T9"YC+G=I;F1O=W,N=VEN9&]W<SL-" D)
M8V]N<W0 2$%.1$Q%($Y/7T9)3$4 /2!)3E9!3$E$7TA!3D1,15]604Q513L-

M>"YL:6YU>#L-" D)86QI87, :6YT($A!3D1,13L-" D)8V]N<W0 2$%.1$Q%


M*$A!3D1,12!H9FEL92P 1FEL94UO9&4 ;6]D92D-" EI; T*"7L-" D)87-S


M(#H

M9&EN9PT*"71H:7,H8VAA<EM=(&9I;&5N86UE*0T*"7L-" D);W!E;BAF:6QE
M;F%M92P 1FEL94UO9&4N26XI.PT*"7T-" D-" D-" ET:&ES*&-H87);72!F







M<SL-" D)"6EF*&UO9&4 )B!&:6QE36]D92Y);BD-" D)"7L-" D)"0EI9BAM

M861A8FQE(#T =W)I=&5A8FQE(#T =')U93L-" D)"0D)86-C97-S(#T 1T5.


M"6%C8V5S<R ]($=%3D5224-?4D5!1#L-
M4$5.7T5825-424Y'.PT*"0D)?0T*"0D)96QS92!I9BAM;V1E("8 1FEL94UO
M9&4N3W5T*2 O+R!*=7-T(&]U= T*"0D)>PT*"0D)"7=R:71E86)L92 ]('1R

M($]014Y?04Q705E3.PT*"0D)?0T*"0D)96QS90T*"0D)>PT*"0D)"6%S<V5R
M=" P*3L-" D)"7T-" D)"0T*"0D)+R\ 06QW87ES('-H87)E(')E860O=W)I

M<FEN9WHH9FEL96YA;64I+"!A8V-E<W,L($9)3$5?4TA!4D5?4D5!1"!\($9)
M3$5?4TA!4D5?5U))5$4L(&YU;&PL(&9L86=S+"!&24Q%7T%45%))0E5415].


M"0D)>PT*"0D)"6EF*&UO9&4 )B!&:6QE36]D92Y/=70I("\O(&EN+V]U= T*
M"0D)"7L-" D)"0D)<F5A9&%B;&4 /2!W<FET96%B;&4 /2!T<G5E.PT*"0D)

M; T*"0D)"7L-" D)"0D)<F5A9&%B;&4 /2!T<G5E.PT*"0D)"0EA8V-E<W, 


M(#T


M(%-?25='4E  ?"!37TE23U1(('P 4U])5T]42"X-" D)"6AF:6QE(#T <W1D
M+F,N;&EN=7 N;&EN=7 N;W!E;BAT;U-T<FEN9WHH9FEL96YA;64I+"!A8V-E


M;W< ;F5W($]P96Y%<G)O<B B1FEL92 G(B!^(&9I;&5N86UE('X (B< ;F]T





M<75I<F4 1FEL94UO9&4N3W5T('1O(&-R96%T92X-" D):68H(2AM;V1E("8 


M9&4 )B!&:6QE36]D92Y);BD-" D)"7L-" D)"0EI9BAM;V1E("8 1FEL94UO

M=&5A8FQE(#T =')U93L-" D)"0D)86-C97-S(#T 1T5.15))0U]214%$('P 


M9BAM;V1E("8 1FEL94UO9&4N3W5T*2 O+R!*=7-T(&]U= T*"0D)>PT*"0D)



M96XH*2X-" D)"6AF:6QE(#T 0W)E871E1FEL94$H=&]3=')I;F=Z*&9I;&5N
M86UE*2P 86-C97-S+"!&24Q%7U-(05)%7U)%040 ?"!&24Q%7U-(05)%7U=2


M"0EI;G0 86-C97-S.PT*"0D):68H;6]D92 F($9I;&5-;V1E+DEN*0T*"0D)
M>PT*"0D)"6EF*&UO9&4 )B!&:6QE36]D92Y/=70I("\O(&EN+V]U= T*"0D)
M"7L-" D)"0D)<F5A9&%B;&4 /2!W<FET96%B;&4 /2!T<G5E.PT*"0D)"0EA


M"0D)?0T*"0D)?0T*"0D)96QS92!I9BAM;V1E("8 1FEL94UO9&4N3W5T*2 O

M86-C97-S(#T 3U]74D].3%D ?"!/7T-214%4('P 3U]44E5.0SL-" D)"7T-

M"2\O(%-H87)E(#T 4U])4E534B!\(%-?25=54U( ?"!37TE21U)0('P 4U])
M5T=24"!\(%-?25)/5$  ?"!37TE73U1(+ T*"0D):&9I;&4 /2!S=&0N8RYL
M:6YU>"YL:6YU>"YO<&5N*'1O4W1R:6YG>BAF:6QE;F%M92DL(&%C8V5S<RP 

M" D)"7)E861A8FQE(#T =W)I=&5A8FQE(#T
M871E. T*"0D)=&AR;W< ;F5W($-R96%T945R<F]R*")5;F%B;&4 =&\ 8W)E

M8FQE(#T

M*%=I;C,R*0T*"0D)>PT*"0D)"4-L;W-E2&%N9&QE*&AF:6QE*3L-" D)"7T-

M=7 N8VQO<V4H:&9I;&4I.PT*"0D)?0T*"0D):&9I;&4 /2!.3U]&24Q%.PT*




M"7L-" D)"4173U)$(')E<W5L=#L-" D)"2\O(')E<W5L=#H (%)E861&:6QE
M('-E=', =&AI<R!V86QU92!T;R!Z97)O(&)E9F]R92!D;VEN9R!A;GD =V]R
M:R!O<B!E<G)O<B!C:&5C:VEN9RX-" D)"5)E861&:6QE*&AF:6QE+"!B=69F


M:6YU>"YL:6YU>"YR96%D*&AF:6QE+"!B=69F97(L('-I>F4I.PT*"0D):68H


M=W)I=&5";&]C:RAV;VED*B!B=69F97(L('5I;G0 <VEZ92D-" EI; T*"7L-


M=#H 5W)I=&5&:6QE('-E=', =&AI<R!V86QU92!T;R!Z97)O(&)E9F]R92!D
M;VEN9R!A;GD =V]R:R!O<B!E<G)O<B!C:&5C:VEN9RX-" D)"5=R:71E1FEL
M92AH9FEL92P 8G5F9F5R+"!S:7IE+" F<F5S=6QT+"!N=6QL*3L-" D)?0T*

M=6QT(#T <W1D+F,N;&EN=7 N;&EN=7 N=W)I=&4H:&9I;&4L(&)U9F9E<BP 

M" D)?0T*"0ER971U<FX 8V%S="AU:6YT*7)E<W5L=#L-
M;W9E<G)I9&4 =6QO;F< <V5E:RAL;VYG(&]F9G-E="P 4V5E:U!O<R!R96PI


M"6-O;G-T($173U)$($)!1%]3145+(#T ,'A&1D9&1D9&1CL-" D)"7)E<W5L
M=" ](%-E=$9I;&50;VEN=&5R*&AF:6QE+"!C87-T*$Q/3D<I;V9F<V5T+"!N

M9E]T(')E<W5L=#L-" D)"6-O;G-T(&]F9E]T($)!1%]3145+(#T 8V%S="AO
M9F9?="DM,3L-" D)"7)E<W5L=" ]('-T9"YC+FQI;G5X+FQI;G5X+FQS965K
M*&AF:6QE+"!C87-T*&]F9E]T*6]F9G-E="P <F5L*3L-" D)?0T*"0EI9BA"

M;F%B;&4 =&\ <V5E:R!F:6QE+B(I.PT*"0ER971U<FX 8V%S="AU;&]N9RER

5=7)N(&AF:6QE.PT*"7T-"GT-" T*
`
end
May 08 2004