提交 71de17d3 编写于 作者: P Patrick Walton

Add a binding to ftell()

上级 ea1321fc
......@@ -24,6 +24,7 @@
impure fn read_le_int(uint size) -> int;
impure fn seek(int offset, seek_style whence);
impure fn tell() -> uint; // TODO: eventually u64
};
state obj FILE_reader(os.libc.FILE f, bool must_close) {
......@@ -97,6 +98,9 @@
}
check(os.libc.fseek(f, offset, wh) == 0);
}
impure fn tell() -> uint {
ret os.libc.ftell(f) as uint;
}
drop {
if (must_close) {os.libc.fclose(f);}
}
......
......@@ -19,6 +19,7 @@
fn ungetc(int c, FILE f);
fn fread(vbuf buf, uint size, uint n, FILE f) -> uint;
fn fseek(FILE f, int offset, int whence) -> int;
fn ftell(FILE f) -> int;
type dir;
fn opendir(sbuf d) -> dir;
......
......@@ -16,6 +16,7 @@
fn ungetc(int c, FILE f);
fn fread(vbuf buf, uint size, uint n, FILE f) -> uint;
fn fseek(FILE f, int offset, int whence) -> int;
fn ftell(FILE f) -> int;
type dir;
fn opendir(sbuf d) -> dir;
......
......@@ -15,6 +15,7 @@
fn ungetc(int c, FILE f);
fn fread(vbuf buf, uint size, uint n, FILE f) -> uint;
fn fseek(FILE f, int offset, int whence) -> int;
fn ftell(FILE f) -> int;
fn _pipe(vbuf fds, uint size, int mode) -> int;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册