hi all
i want to read a secific line in a text file
here is the text file form

iphuc 0.6.1 with tab completion.
>> By The iPhoneDev Team: nightwatch geohot ixtli warren nall mjc operator
Unsupported iTunesMobileDevice.dll Version ee0000 15
CFRunLoop: Waiting for iPhone.

or

iphuc 0.6.1 with tab completion.
>> By The iPhoneDev Team: nightwatch geohot ixtli warren nall mjc operator
Unsupported iTunesMobileDevice.dll Version ee0000 15
notification: iPhone attached.
CFRunLoop: Waiting for iPhone.
AMDeviceStartService 'com.apple.afc': 0
deviceinfo:
FSFreeBytes: 14891978752
Model: This is changed
FSTotalBytes: 15527268352
FSBlockSize: 4096

i want it to write the model value in textbox1 so anyone pls help me

Edited 5 Years Ago by seifhatem: n/a

Member rule:

  • Do provide evidence of having done some work yourself if posting questions from schoolwork assignments

Open up the file in an ifstream, read with getline(istream& is, string& str).

Edited 5 Years Ago by MosaicFuneral: n/a

Well you can try this:

while (count != required_line) {
    getline(----); // appropriate arguments
    count++;
}

getline

And i agree with MosaicFuneral. Post whatever code you have already written

Edited 5 Years Ago by myk45: n/a

It would probably be best if you posted what you had so we could see what you need to change but you could use std::vector then use the vector to access a specific line

string n;
vector <string> v;
while (getline( myfile, n ))
{
v.push_back( n );
}
cout << "line 9 = " << v[ 9 ] << endl;

hope you can sync this with what you have

This article has been dead for over six months. Start a new discussion instead.