mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-26 23:24:34 +00:00
Add 'tell' method to raw_fd_ostream that clients can use to query the current location in the file the stream is writing to.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60085 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -176,6 +176,9 @@ public:
|
|||||||
|
|
||||||
/// close - Manually flush the stream and close the file.
|
/// close - Manually flush the stream and close the file.
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
|
/// tell - Return the current offset with the file.
|
||||||
|
uint64_t tell();
|
||||||
};
|
};
|
||||||
|
|
||||||
/// raw_stdout_ostream - This is a stream that always prints to stdout.
|
/// raw_stdout_ostream - This is a stream that always prints to stdout.
|
||||||
|
@ -253,6 +253,14 @@ void raw_fd_ostream::close() {
|
|||||||
FD = -1;
|
FD = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t raw_fd_ostream::tell() {
|
||||||
|
// We have to take into account the bytes waiting in the buffer. For now
|
||||||
|
// we do the easy thing and just flush the buffer before getting the
|
||||||
|
// current file offset.
|
||||||
|
flush();
|
||||||
|
return (uint64_t) lseek(FD, 0, SEEK_CUR);
|
||||||
|
}
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// raw_stdout/err_ostream
|
// raw_stdout/err_ostream
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
Reference in New Issue
Block a user