c_-_c_files:file_seek
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
c_-_c_files:file_seek [2017/10/12 14:56] – created peter | c_-_c_files:file_seek [2020/07/15 09:30] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 31: | Line 31: | ||
return 0; | return 0; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Seek and Skip ===== | ||
+ | |||
+ | <code cpp> | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | using namespace std; | ||
+ | |||
+ | int main() | ||
+ | { | ||
+ | ifstream in(" | ||
+ | in.unsetf(ios:: | ||
+ | char ch; | ||
+ | |||
+ | while (in >> ch) | ||
+ | { | ||
+ | cout << ch; | ||
+ | } | ||
+ | |||
+ | cout << ' | ||
+ | |||
+ | in.clear(); | ||
+ | in.seekg(ios:: | ||
+ | in.setf(ios:: | ||
+ | |||
+ | while (in >> ch) | ||
+ | { | ||
+ | cout << ch; | ||
+ | } | ||
+ | |||
+ | cout << ' | ||
+ | |||
+ | return 0; | ||
} | } | ||
</ | </ | ||
c_-_c_files/file_seek.1507820207.txt.gz · Last modified: 2020/07/15 09:30 (external edit)