Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, May 2007
How Can I fine position of a perticular string in a file


Message 1 in thread

hi all,
     Please try to answer My Question.
     Iam having a File contains some data. 
     I want to find at which position(Might be: no of Bytes/ Line Number,column Number) of perticular string.
     how can i do that one.is there any function provided by QT at QFile that solves My Purpose.Please Let me know
     
     
     thanks
     


D. Anil kumar

Every success has a story of great failure.
So don't stop with failure where
Success comes after failure.

Message 2 in thread

No.  Read in the file, line by line, and use QString::find

 

 

Scott

 

________________________________

From: anil kumar [mailto:d.anil@xxxxxxxxxxxxx] 
Sent: Wednesday, May 09, 2007 12:21 AM
To: qtForum
Subject: How Can I fine position of a perticular string in a file

 


hi all,
     Please try to answer My Question.
     Iam having a File contains some data. 
     I want to find at which position(Might be: no of Bytes/ Line
Number,column Number) of perticular string.
     how can i do that one.is there any function provided by QT at QFile
that solves My Purpose.Please Let me know
     
     
     thanks
     

 

 

D. Anil kumar

 

Every success has a story of great failure.
So don't stop with failure where
Success comes after failure.


Message 3 in thread

Hi,

> No.  Read in the file, line by line, and use QString::find

Indeed Qt doesn't provide an API for that.

Note that the OS doesn't provide an API for that either. Whether you're using 
Qt or any other library, the solution is to read the file into memory (either 
the whole file or a few blocks at a time) and search for the string in memory.

--
 [ signature omitted ] 

Message 4 in thread

On 5/9/07, anil kumar <d.anil@xxxxxxxxxxxxx> wrote:
> hi all,
>      Please try to answer My Question.
>      Iam having a File contains some data.
>      I want to find at which position(Might be: no of Bytes/ Line
> Number,column Number) of perticular string.
>      how can i do that one.is there any function provided by QT at QFile
> that solves My Purpose.Please Let me know

Hi Anil,
I'll try my best to answer Your Question. If you having a some task to
solve, you should first read through documentation to try to find out
if there any way to do it directly.Most probably not, because no
toolkit can (neither should try to) provide solution for every
possible problem in the world. After you are sure that you don't have
out-of-the-box solution, get familiar with your toolkit API to find
out how to implement the desired functionality using an available
tools. This exactly the answer for your question - you are aiming too
hight, expecting the toolkit (Qt) to provide some high-level
functionality, and what you need to do, is to read through lower level
API (in this case QFile, QString, data and text streams) and implement
what you need with this tools. Hope it helps you to Solve You Purpose
in the future.

-- 
 [ signature omitted ]