473,388 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

C++ read / modify text file help

Hello,
I am trying to write a program that will analyse a text file and do the following:

1. Count the number of characters.
2. Count the number of spaces.
3. Count the number of words.
4. Count the number of sentences.
5. Count the number of lines.
6. Ensure the 1st non-blank character in a sentence is capitalized. (I think this is done using a C function?)

Does anyone have any suggestion as to how I'd go about doing this? any samples of code / pointers to tutorials would be appreciated

I've got limited experience making easy games using visual C++, uisng timers etc but non visual C++ is still very alien to me!

Many Thanks!
Jim
Jun 16 '06 #1
2 8430
sashi
1,754 Expert 1GB
Hi there,

you seems to be asking some serious thing here buddy.. was just kidding.. i assume ur trying to create some sort of editor kind of application.. correct me if am wrong.. well.. there few site offering complete application together with their source code.. heard about GNU?? try looking in;

www.sourceforge.net
www.freshmeat.net
Jun 16 '06 #2
Banfa
9,065 Expert Mod 8TB
If sashi suggestions do not solve your problem then programatically what you need to do is
  1. Open the file
  2. Read it character by character (or read it in 1 lump into memory and scan that memory character by character which is more efficient).
  3. Work out a rule for all the various counts you require, for instance number of characters, number of spaces and number of lines are fairly obvious, sentences and capitalisation is only slightly harder, words are probably the trickest thing. No the easy ones first.
  4. Implement your rules.
Jun 16 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: ezmeralda | last post by:
Hello, I have to solve the following task: - create an editor-application in c# to read, modify and create xml-files - .xsd-schema-file is available and can be used Currently, I am thinking...
1
by: Magix | last post by:
Hi, I have these string data: str_data1, str_data2, str_data3, which capture some value after a routine process A. Then I would like to write (append) these 3 string values into a text file each...
12
by: James Norton-Jones | last post by:
Hi, Am I trying to hold the data of a DataGrid in a label so that when the form is reposted the DataGrid can be repopulated. The problem I am having is that I don't understand how to get the...
4
by: c++ newbie | last post by:
hello gurus of C++ programming, I am a student doing my masters in computer applications.I am a bit experienced in VB 6.0.I am currently doing a project in vb 6. To accompish a certain task I...
1
by: JOSII | last post by:
Does anyone know if it is possible to either add, modify or read the properties of a plain text (*.txt) file using Visual Basic 2005? I know it's possible with Office Documents like Word or Excel,...
2
by: =?Utf-8?B?YW5rMmdv?= | last post by:
Thanks in advance for reading this. Let's say I have a file (file01) with this data in ASCII (ignore line col): line01 123abc line02 Header01 Starts blah var line03 detail01 000001...
7
by: Frank | last post by:
Years ago I wrote a program to read .lnk files, modify the data and rewrite the file. I modified it slightly and used it for .pif files. I can't find it nor can I find the API calls I used. ...
2
by: RyanS09 | last post by:
Hi- I have read many posts with specific applications of reading in text files into arrays, however I have not been able to successfully modify any for my application. I want to take a text file...
4
by: someone28485 | last post by:
hi,i need 2 write code in C#.Net to read a text file with text as 22.13 21.65 25.16 31.22 and so on, i need 2 read this text and then take mean of the 4 values and write that mean result in...
5
by: =?Utf-8?B?bXBhaW5l?= | last post by:
Hello, I am completely lost as to why I can't update a DropDownList inside a DetailsView after I perform an insert into an object datasource. I tried to simply it down to the core demostration:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.