Click to See Complete Forum and Search --> : How to find a strin from a file


yang
April 21st, 1999, 03:13 PM
I got a .txt file here, and in the file there is a column, "TB". Under the column, there are two kinds of string, "T" or "B". I need write some codes for searing the string ,"T", and put the related data (with string"T") into a new file? Anyone can help me out with this??

thank you

MoMoPi
April 22nd, 1999, 03:25 PM
You need write code like "parser", to read the text file and extract the string that you want.

1.you have to know what is the seperator.(, or space)
2.I am assuming the \n is the end of line.

Try to write a member function use strtok(..,..)and while loop (!file1.eof()) to get the string "T".