Read and extract text / number

Hello people..

I have been playing alot with PHP in the past, but i must admit i forgot some of it !... and there for seeking help, since i havent been able to find my awnsers here in the forum or google for that matter...

I got a text file with lots of information, but i only seek to find the word Length and export the number it show┬┤s ..
( and for example if i got lets say 10 txt files, with all diffrent names but with the same word ( Length ) and want the number to get exported to 1 text file )
all in the same folder as the exe file.. is that possible ?.

When it then retrieve the number, lets say its Length 800 ... it then adds 10 and then you take 5800 divide it by 810 you get 7.16 ( then you take 6000 diveded by 7 ) which gives 857 ....

so all i want, is all the text files to get read ( length ) the number, the math, and the result posted in a text file..

is this possible with c++ ? if so can you guide me in the direction ?

my questions/suggestions have nothing to do with either C++ nor Windows programming, it's more general.

Questions: is the word 'Length' at the start/beginning of a record/line? If no, is it surrounded by blanks or at least by "white space"? The number following 'Length' is it on the same line or could it be in next record too? Is the number surrounded by blanks or at least by *white space"? Does the number contain a decimal point and/or thousands separators (if applicable)? If yes, what character is used for the decimal point (a point or a comma), what character is used as thousands separator (point, comma, blank, inverted comma, younameit)?

Proposal: If 'Length' occurs only at the beginning of records, get those records. The number is word 2 of this record (unless blanks are used as thousands separator). Otherwise, if 'Length' is not at the beginning of records, and 'Length' and the following number are both enclosed by blanks (and thousands separator is not blank), then dice up your file and make words to single recrods. Then the number is the next non-blank record (there could be several blanks separating 'Length' and number) after the one containing 'Length'.

is this possible with c++ ?
I suppose yes. But it could be possible, you may have to reinvent the wheel that in other systems turns well and since long.
its possible, we know that.
how annoying it may be depends on what the data actually looks like and what you mean by 'word'. if you have to parse the file, that may take some work. If its the length of a line, that is simple.
Registered users can post here. Sign in or register to post.