2006-09-04 10:26:34 +02:00
|
|
|
Although not every tt(istream) object supports i(repositioning), some do. This
|
|
|
|
means that it is possible to read the same section of a stream
|
|
|
|
repeatedly. Repositioning is frequently used in emi(database applications)
|
|
|
|
where it must be possible to access the information in the database randomly.
|
|
|
|
|
2009-10-23 16:54:40 +02:00
|
|
|
The current position can be obtained and modified using the following members:
|
2006-09-04 10:26:34 +02:00
|
|
|
itemization(
|
2012-02-26 17:19:16 +01:00
|
|
|
ithtq(tellg)(ios::pos_type tellg())
|
2011-11-07 18:04:51 +01:00
|
|
|
(hi(pos_type)the stream's current (absolute) position where the
|
|
|
|
stream's next read-operation will take place is returned.)
|
2009-10-23 16:54:40 +02:00
|
|
|
ithtq(seekg)
|
2009-12-28 17:56:23 +01:00
|
|
|
(istream &seekg(ios::off_type step, ios::seekdir org))
|
2009-10-23 16:54:40 +02:00
|
|
|
(modifies a stream's actual position. The function expects an
|
|
|
|
ti(off_type) tt(step) representing the number of bytes the current stream
|
2011-11-07 18:04:51 +01:00
|
|
|
position is moved with respect to tt(org). The tt(step) value may be negative,
|
|
|
|
zero or positive.
|
2009-10-23 16:54:40 +02:00
|
|
|
|
|
|
|
The origin of the step, tt(org) is a value in the
|
|
|
|
hi(seekdir)tt(ios::seekdir) enumeration. Its values are:
|
2006-09-04 10:26:34 +02:00
|
|
|
itemization(
|
2009-10-23 16:54:40 +02:00
|
|
|
ithtq(beg)(ios::beg)
|
|
|
|
(the stepsize is computed relative to the beginning of the
|
2009-10-25 17:44:33 +01:00
|
|
|
stream. This value is used by default.
|
2009-10-23 16:54:40 +02:00
|
|
|
)
|
|
|
|
ithtq(cur)(ios::cur)
|
|
|
|
(the stepsize is computed relative to the current position of the
|
|
|
|
stream (as returned by tt(tellp)).
|
|
|
|
)
|
2010-10-09 15:20:09 +02:00
|
|
|
ithtq(end)(ios::end)
|
2009-10-23 16:54:40 +02:00
|
|
|
(the stepsize is interpreted relative to the current end position
|
|
|
|
of the the stream.)
|
2006-09-04 10:26:34 +02:00
|
|
|
)
|
2009-10-23 16:54:40 +02:00
|
|
|
It is OK to hi(seek beyond file boundaries) seek beyond the last file
|
2010-10-09 15:20:09 +02:00
|
|
|
position. Seeking before tt(ios::beg) raises the hi(failbit)tt(ios::failbit)
|
|
|
|
flag.
|
2006-09-04 10:26:34 +02:00
|
|
|
)
|
|
|
|
)
|