I have a text file and i want to replace a word from a specific location. For example want to replace 5th word from 12th line of file. How i can do that?

Re: How to replace a word from a specific location of a file in c++ 80 80

Read the file one word at a time, saving the words in another file except replace the 5th word (or whatever number it is) with the new word. You need two files, an input file and an output file.

Re: How to replace a word from a specific location of a file in c++ 80 80

Once you have read the target word and written the replacement into the output file, you can read/write the rest of the source file into the output file, in chunks, for efficiency's sake.

Re: How to replace a word from a specific location of a file in c++ 80 80

dear post example of record replace plz

Be a part of the DaniWeb community

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