let say I hv a row of text 'date' 'amount1' & 'amount2'.. by using ifstream I able to read a file, but how about I want to read the 3rd data?
use seek?
Use as normal, and just ignore the data you don't want to use.
ifstream someStream("file.data");
std::string dataInput;
someStream >> dataInput;
someStream >> dataInput;
someStream >> dataInput; // Now use this one
Loops etc can do the heavy lifting.
>> use seek?
Sure, why not?
Seriously, if you want a more useful answer, you'll need to post a much more descriptive question. Your question is unanswerable as written.
[EDIT]
Perhaps not. Moschops apparently understands what you are asking..
[/EDIT]
>> use seek?
Sure, why not?
Seriously, if you want a more useful answer, you'll need to post a much more descriptive question. Your question is unanswerable as written.
[EDIT]
Perhaps not. Moschops apparently understands what you are asking..
[/EDIT]
you are right.. Moschops's suggestion was pretty cool, however my file will be appended with coming rows so his method didn't work..
my program : user key in an amount > calculation > program key data in into a file (let it be A) > program end.
next time I want to read A, user key in amount > calculation > program key date into file again..
you are right.. Moschops's suggestion was pretty cool, however my file will be appended with coming rows so his method didn't work..
That makes no sense. Are you ignoring the read in data properly?
That makes no sense. Are you ignoring the read in data properly?
I explain my desire program.. I want to build a mini financial program which you key in an amount daily and the saving left will be deducted, and the result will be stored in a text file. If I set the amount fix, the program can't work because when I need to close the program after I've done key in my spending.. so I need to read the last saving left to perform the next calculation is it?
Date Amount spend Saving left
11/16/11 -RM7.00 RM993.00
The program output gonna be like this..
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.