program to replace comm and space with tabs

C

channu

Hi

I am beginner in c++ coding.I want to read a text file and replace
commas and space with tabs.

Can any buddy help me out.
Thanks
Channu
 
B

benben

channu said:
Hi

I am beginner in c++ coding.I want to read a text file and replace
commas and space with tabs.

Can any buddy help me out.
Thanks
Channu

Give your code we'll see how to help you.

Ben
 
O

osmium

channu said:
I am beginner in c++ coding.I want to read a text file and replace
commas and space with tabs.

There are a huge number of ways to do this, some of them quite impressive to
look at with iterators liberally sprinkled with the all purpose word
"const". IMO, there is no one "right" way to do it.

I would write a while loop, examine each character as it came in, and if it
were a comma or a space, I would replace the character with the tab
character.
 
J

JS92647

osmium said:
There are a huge number of ways to do this, some of them quite impressive to
look at with iterators liberally sprinkled with the all purpose word
"const". IMO, there is no one "right" way to do it.

I would write a while loop, examine each character as it came in, and if it
were a comma or a space, I would replace the character with the tab
character.

Osmium is on the right track. I did a similar thing a few months ago.
Basically all you have to use is fstream to open up a file, and if it
finds a "," or a similar character, replace it with something else.
There is a specific function for this but I can't recall it off the top
of my head.

Oh, and questions like these are best left for google :).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top