Yes, the file does open. That's why I read a little of the file and
echo to the screen.
> Yes, the file does open. That's why I read a little of the file and
> echo to the screen.
Sorry, I'm having trouble duplicating your symptoms. If the file
successfully opens, I keep getting a return of 0 from tellg() in your
example.
The only suggestion I'm coming up with at the moment is to initialize
your "line" to zero to ensure that you're not printing out garbage:
char line[256] = {0};
Assuming a successful open, the only calls to BSD C your program should
be making (under tellg) is:
fseek(file_, 0, SEEK_CUR);
ftell(file_);
(these calls are made in <msl_C_filebuf> in the function seek_device)
If either of those calls fail, then tellg() will return -1 as you
report. But I currently do not see a reason for these calls to fail,
assuming of course that file_ points to a valid, open, FILE.
-Howard
dougn@tiac.net - 26 May 2005 16:01 GMT
Nope. I placed a memset in there to zero out line and the file reads
ok but -1 is still being returned. Maybe I have something messed
with my project. Can I email you my project?
Howard Hinnant - 26 May 2005 18:41 GMT
> Nope. I placed a memset in there to zero out line and the file reads
> ok but -1 is still being returned. Maybe I have something messed
> with my project. Can I email you my project?
Sure.
-Howard