Re: where() behavior in append mode
- Posted by Robert Craig <rds at RapidEuphoria.com> Jan 19, 2002
- 397 views
Bob writes: > after 3 days of weeping and gnashing of teeth trying to > squash a bug, I noticed a problem with where() I ran your demo program and got the same incorrect results. I also translated/compiled with DJGPP and got the correct results. I believe you are correct that where() is unreliable on files opened in append mode when WATCOM is involved, i.e. in ex and exw, which are compiled with WATCOM. By the way, your example does work correctly if you call flush() after puts(), but you shouldn't have to do that. I searched the Web and found a message posted by someone who encountered this same problem in Watcom 10.6 (that I'm using). He also looked at the source code for Watcom 11.0, and found that they have "fixed" the problem, by forcing a flush() inside the C ftell() library routine that I call to implement where(). I think I'll just put a warning in the docs for where() in the 2.3 final release. Not many people use where() with files opened in append mode. You are the first to report this. Thanks for the detailed error report, and I'm sorry about the time and emotional energy you wasted. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com