473,503 Members | 12,175 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

program to replace comm and space with tabs

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

May 4 '06 #1
3 2954
channu wrote:
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
May 4 '06 #2
"channu" writes:
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.
May 4 '06 #3
osmium wrote:
"channu" writes:
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.


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 :).
May 6 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
3996
by: Christian Seberino | last post by:
Linux kernel style guide, Guido's C style guide and (I believe) old K&R style recommends 8 SPACES for indent. I finally got convinced of wisdom of 8 space indentation. Guido also likes 8 space...
0
1340
by: Mark Hahn | last post by:
Ville Vainio came up an idea for one final tweak of the tab/space indent algorithm we are using in Prothon, and the final result surprised me, in that it directly addresses the problem of mixed...
1
2455
by: OZ | last post by:
the serproxy claim itself a multi-thread proxy thing. I have sent email to write the original writer and there is no replay after 3 weeks. my configuration and setting are good. ...
19
5665
by: Alex Vinokur | last post by:
Is there any tool to count C-program lines except comments? Thanks, ===================================== Alex Vinokur mailto:alexvn@connect.to http://mathforum.org/library/view/10978.html...
6
3111
by: Ken | last post by:
When running a program in the debugger, what would cause it to crash without any error messages? I get "The program has exited with code 0 (0x0)". The program is a MDI app with threading for...
4
2087
by: KenFehling | last post by:
Hello. I am wondering if there exists a piece of software that takes multiple .js files that are nicely indented and commented and create one big tightly packed .js file. I'm hoping the one file...
8
328
by: someone | last post by:
I tried to make a program that's called "Don't Shout", that reads from a file "input.dat", and all letters should be lower-case, expect for the first letter, and any letter after a period should be...
7
1969
by: ramasubramanian.rahul | last post by:
hi i was trying to see how the compiler hides the static golbals from the linker and allows golbal varibale to be visable to the linker.i managed to figure out how it did that ( the .lcomm and...
14
2014
by: inpuarg | last post by:
I want to find a & character using Regex. But not && How can i manage this in c# Quickfind window ? -------------------------------------------------- ne kadar yažarsan yaža sevdišin kadardżr...
0
7193
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6975
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5562
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
371
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.