hi all , i have a txt file called myfile.txt , i want to open this file and search for the following
" this page is good/"

if i find this i want to read every thing after "/" until i reach <b> so for example

this page is good/so i want to copy this<b>

dont mind my question but i really dont know much in C++


thanks for your great help

any help???

1. Open file
2. Retrieve data in a string
3. Compare
4. Once you find a match then read again till you find first <b>

i need the code for that , i really dont know alot in C++

We really don't like to write whole programs or routines for people. Here's a quick overview with a little more detail than p;rovided by Grunt. As you can tell, there are several choices you will have to make depending on what you know and don't know.

The phrase you are looking for is called a string. The file you are searching can be opened and read in as a sequence of strings or as a single string. You will then need to search for the string(s) from the file for the desired string. If found, the desired string is called a substring of the whole string. There are several ways to search for a substring depending on the type of string you use. You could use strstr() if you use C style strings, and I'm sure that the STL library will have functions to search for substrings as well, either in the string library itself or in the algorithm library. It would also be instructive to write your own function to familiarize yourself with the workings of strings. Last, but not least, if you aren't familiar with the concept of strings at all, then this project is beyond your scope of programming at this point and you should set your sights a little lower for now---like learning about strings, working with files, etc.

commented: [Grunt] +1

Show some effort. I don't think anyone here will give you code this way.

Look into string methods, like .find(), .delete(), etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.