Hi, all,

Sorry I'm late to the thread, but I can confirm that seeking doesn't work for 
files open in text mode in VC++.  I ran into this with some of my software in 
the past.  It's rather unbelievable, but it's true.  

The docs at msdn.microsoft.com confirm it (search for seekg and look at the 
remarks).  The same is true for the fseek() function in C.

JS's unget fix is probably the best workaround.

--"J"

Sent from my iPhone

On Jun 27, 2011, at 11:38 PM, "Robert Osfield" <[email protected]> wrote:

> Hi J-S,
> 
> On Mon, Jun 27, 2011 at 8:29 PM, Jean-Sébastien Guay
> <[email protected]> wrote:
>> Here is the file (src/osgPlugins/osg/AsciiStreamOperator.h), and you might
>> want to put a descriptive comment so people know why this was done... After
>> all, my instinct would be to replace a loop with a single function call
>> too...
> 
> Many thanks for the fix, finally back on track....albeit rather later
> in the evening than I had planned.  The comment of explanation I went
> for was:
> 
> 
>    virtual bool matchString( const std::string& str )
>    {
>        std::string s; readString(s);
>        if ( s==str ) return true;
>        else
>        {
>            // originally "_in->seekg( -(int)(s.length()),
> std::ios::cur );" was used below but
>            // problems under windows occurred when reading ascii
> files with unix line endings.
>            // The workaround for this problem was to unget each of
> the characters in term,
>            // hacky yes, but at least it works!
>            for (unsigned int i = 0; i < s.length(); ++i)
>                _in->unget();
>        }
>        return false;
>    }
> 
> Let me know if it doesn't make sense.  I've now merged this change
> with svn/trunk and the OSG-3.0 branch.
> 
> Robert.
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to