[Issue 2689] New: seek behaves incorrectly on MAC OSX

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 25 07:48:51 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2689

           Summary: seek behaves incorrectly on MAC OSX
           Product: D
           Version: 1.040
          Platform: Macintosh
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: swadenator at gmail.com


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


-- 



More information about the Digitalmars-d-bugs mailing list