Readinf text file

Newbie Member
14May2009,00:23   #1
Kodila's Avatar
Hi again.

I got a littel problem, i just cant find the solution.
I read the txt file, then print it and its all fine.
I can search some chars and calculate how many that kind of chars are in txt file.
But are there posibiliti to input lets say 'a' and then it will search first 'a' letter and next lets say 10 chars.
Mentor
14May2009,13:00   #2
xpi0t0s's Avatar
Yep, so you would need to read a character from the user, open and search the file for that character in exactly the same way you currently do, then just count off 10 characters and do whatever you want to do with them.
Newbie Member
14May2009,22:54   #3
Kodila's Avatar
I know that, but i cant figur out how to count them...with somekind of array?loop?, mayby there are somewhere somekind of tutorial or help file???.
~ Б0ЯИ Τ0 С0δЭ ~
14May2009,23:49   #4
SaswatPadhi's Avatar
Quote:
Originally Posted by Kodila View Post
i cant figur out how to count them
You know how to find the first occurrence of 'a', but you don't know how to count next 10 chars ?!

You may use :
Code: c++
char ExtractedChar(10);
ifstream FileIn("myfile.ext");
.
// search for first occurrence
.
for (int i = 0; i < 10; ++i) ExtractedChar[i] = FileIn.get();
.
// continue
.
Newbie Member
16May2009,04:12   #5
Kodila's Avatar
tnx il try that.