On Thursday 29 October 2015 00:36:08 Igor Mironchik wrote:
> This is good, but what if I need to seek stream to the one character 
> back position? Can I simple write
> 
> stream.seek( stream.pos() - 1 );
> 
> or I have to keep in mind codec? If so how can I seek to one character 
> back position and don't worry about codecs, etc...

Avoid doing that. Seeking the stream is an expensive operation since 
QTextStream needs to flush the buffers, reposition the device and reconvert 
the input into UTF-16 without Carriage Return.

I don't know what happens if you position it after the CR but before the LF. I 
know what happens if you position in the middle of a multibyte sequence: the 
first character you'll read will be either mojibake or the Unicode Replacement 
Character (U+FFFD).

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to