From kde-core-devel Thu Jun 07 07:23:28 2001 From: Michael Goffioul Date: Thu, 07 Jun 2001 07:23:28 +0000 To: kde-core-devel Subject: Re: Ungetch: Unicode compliant? X-MARC-Message: https://marc.info/?l=kde-core-devel&m=99189881623132 > 1) what do you want to do ? ungetch apparently only decrements the current > read pointer, so that a next readLine() will reread the same text. doing > this is usually a very bad and errorprone coding-style. > > 2) QString::length _might_ be different from the length of the string in the > file because of the applied conversions. You're lost at this point, because > you can hardly know how many bytes you have to "roll-back". My goal is to put a line of text back to a text file (or back to a buffer that get its data from a text file, but I don't know if such class exists). I'm parsing a file on a line basis, which makes the parsing code quite elegant. The problem is that I only know I have to stop parsing (temporarily) when I get a line starting with a specific character. However this line has to be read again later. That's why I used ungetch. Michael. -- ------------------------------------------------------------------ Michael Goffioul IMEC-DESICS-MIRA e-mail: goffioul@imec.be (Mixed-Signal and RF Applications) Tel: +32/16/28-8510 Kapeldreef, 75 Fax: +32/16/28-1515 3001 HEVERLEE, BELGIUM ------------------------------------------------------------------