| | |
Edit and replace strings in a text file
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2008
Posts: 2
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Jan 2008
Posts: 3,828
Reputation:
Solved Threads: 501
•
•
•
•
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.
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.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
•
•
Join Date: Sep 2008
Posts: 2
Reputation:
Solved Threads: 0
•
•
•
•
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
![]() |
Similar Threads
- html table to .csv (HTML and CSS)
Other Threads in the C++ Forum
- Previous Thread: graphical based Authentication
- Next Thread: right to left associative
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file forms fstream function functions game generator getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






