471,047 Members | 1,283 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,047 software developers and data experts.

cin.seekg() problem

i am trying to use the seekg(offset, base) function to move the read position but cant seem to do it correctly. When i use tellg() to know if the seekg operation is
successful or not , the tellg() will always return -1. Heres the code.

#include <iostream>

using namespace std;

int main()

char ch;


cin.seekg(0, ios::end);


return 0;

Please help me out .. i cant sleep like this :(
Aug 12 '06 #1
1 5673
9,065 Expert Mod 8TB
using seek and tell works on files but not on the standard input and output streams because there is no-where to seek to on an input or output stream.
Aug 13 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Kapil Khosla | last post: by
2 posts views Thread by Brian Ronk | last post: by
3 posts views Thread by nomad5000 | last post: by
12 posts views Thread by Julian | last post: by
1 post views Thread by fmufti | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.