Hi,
I am trying to replace a few text strings in a text file (test.txt), and then makeing some spaces, for it to be easier to read

Anyone have an example I can use, because I am new to C++

I just want to replace "word1" with red "word2", and then if the outputfile couldt be in html, then it should be posible to convert the black"word1" with red"word2"

I have tried to use an SED editor, and it works ok. But I would like to have the option to have different colour in the output file.
There for I hope that someone would make me a sample file. I think it is quite easy for people that know a little about c++

Regards
Brian

Recommended Answers

All 4 Replies

Hi,
I am trying to replace a few text strings in a text file (test.txt), and then makeing some spaces, for it to be easier to read

Anyone have an example I can use, because I am new to C++

I just want to replace "word1" with red "word2", and then if the outputfile couldt be in html, then it should be posible to convert the black"word1" with red"word2"

I have tried to use an SED editor, and it works ok. But I would like to have the option to have different colour in the output file.
There for I hope that someone would make me a sample file. I think it is quite easy for people that know a little about c++

Regards
Brian

It may well be easy for people who know C++, but one, we have no idea what your input file looks like, and two, we don't know what you want the output file to look like given a certain input file. I can guess what they may look like, but your explanation is not sufficient. Three, no one is going to write the whole program for you. Provide a short input file and the output file that corresponds to it and post your attempt.

>>I have tried to use an SED editor, and it works ok. But I would like to have the option to have different colour in the output file

There is no such thing as color in a file. To color, or not to color is all up to the editor that is being used. In HTML you have [color=???] tags. There isn't anything like that in plain text files.

I think you are trying to create an html file, which does support colored text. To do this, you will need a very basic knowledge of both the fstream library and html coding. If you do not have this knowledge then it will be very difficult to help you.

I think you are trying to create an html file, which does support colored text. To do this, you will need a very basic knowledge of both the fstream library and html coding. If you do not have this knowledge then it will be very difficult to help you.

You are right. The output file should be a html.
I will try to read something about the fstream library.
Thanks for the reply

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.