llvm.org GIT mirror llvm / 9c27886
Add method raw_fd_ostream::seek() for random access within a file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63044 91177308-0d34-0410-b5e6-96231b3b80d8 Ted Kremenek 11 years ago
2 changed file(s) with 11 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
180180 /// tell - Return the current offset with the file.
181181 uint64_t tell() {
182182 return pos + (OutBufCur - OutBufStart);
183 }
183 }
184
185 /// seek - Flushes the stream and repositions the underlying file descriptor
186 /// positition to the offset specified from the beginning of the file.
187 uint64_t seek(uint64_t off);
184188 };
185189
186190 /// raw_stdout_ostream - This is a stream that always prints to stdout.
254254 FD = -1;
255255 }
256256
257 uint64_t raw_fd_ostream::seek(uint64_t off) {
258 flush();
259 pos = lseek(FD, off, SEEK_SET);
260 return pos;
261 }
262
257263 //===----------------------------------------------------------------------===//
258264 // raw_stdout/err_ostream
259265 //===----------------------------------------------------------------------===//