diff options
| author | Patrick Walton <[email protected]> | 2011-03-21 16:40:26 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2011-03-21 16:41:18 -0700 |
| commit | 71de17d38ee8db40e5f50d2ce8986e9676767309 (patch) | |
| tree | 14f9488a26199c0d17c5ec275068da1f638e86cd /src/lib/io.rs | |
| parent | Minor distcheck fixes (diff) | |
| download | rust-71de17d38ee8db40e5f50d2ce8986e9676767309.tar.xz rust-71de17d38ee8db40e5f50d2ce8986e9676767309.zip | |
Add a binding to ftell()
Diffstat (limited to 'src/lib/io.rs')
| -rw-r--r-- | src/lib/io.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/io.rs b/src/lib/io.rs index 58cb1f80..165fe030 100644 --- a/src/lib/io.rs +++ b/src/lib/io.rs @@ -24,6 +24,7 @@ type reader = 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 @@ state obj FILE_reader(os.libc.FILE f, bool must_close) { } 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);} } |