I have a txt file in this format:

111,5.67,2,4,566666,666667
111,5.67,2,4,566666,666667
111,5.67,2,4,566666,666667
111,5.67,2,4,566666,666667

Is there any way so i can open the file and at the end of each line binarynumber to become:

111,5.67,2,4,566666,666667,111000,111000
111,5.67,2,4,566666,666667,111000,111000
111,5.67,2,4,566666,666667,111000,111000
111,5.67,2,4,566666,666667,111000,111000

You will have to rewrite the entire file. Rea the original file into memory, append the data in memnory, then rewrite the file with the new lines.

If i want to replace the last two numbers with its equivalent binary and not append.so the format will become:

111,5.67,2,4,111000,111000 instead of
111,5.67,2,4,566666,666667,111000,111000

Like I said, read a line, do whatever you want to it, then rewrite the new line to another file.

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.