Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
February 25, 2009 OSX stream seek/read problem | ||||
---|---|---|---|---|
| ||||
The following code behaves differently on OSX than LINUX (DMD 1.040): import std.stdio; import std.stream; import std.file; int Lines(Stream f) { int ln = 0; foreach (char[] line; f) ln++; return ln; } void main(char[][] args) { auto f = new BufferedFile(args[1]); int l = Lines(f); f.seek(0, SeekPos.Set); int r = Lines(f); fwritef(stderr, "Lines before: %d, Lines after: %d\n", l, r); } Results for OSX: Lines before: 1633, Lines after: 0 Results for LINUX Lines before: 1633, Lines after: 1633 Seek not working properly perhaps? wade |
February 25, 2009 Re: OSX stream seek/read problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to wade | wade Wrote: > Seek not working properly perhaps? May be related... http://www.opendarwin.info/opendarwin.org/en/faq/ch04.html#lseek |
February 25, 2009 Re: OSX stream seek/read problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | Kagamin Wrote:
> wade Wrote:
>
> > Seek not working properly perhaps?
>
> May be related... http://www.opendarwin.info/opendarwin.org/en/faq/ch04.html#lseek
seems like phobos needs some error handling.
|
February 26, 2009 Re: OSX stream seek/read problem | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kagamin | looks like a candidate. Probably a bug in phobos.
Kagamin Wrote:
> Kagamin Wrote:
>
> > wade Wrote:
> >
> > > Seek not working properly perhaps?
> >
> > May be related... http://www.opendarwin.info/opendarwin.org/en/faq/ch04.html#lseek
>
> seems like phobos needs some error handling.
|
Copyright © 1999-2021 by the D Language Foundation