473,569 Members | 2,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to go over the txt file to get all (two) from file?PLZ help

17 New Member
How can I get every Token (word) and PreviousToken(P revious word) From text file
For example if the text file content is
"Every man has a price. Every woman has a price."

First Token(word) is "Every" PreviousToken(P revious word) is none(no previos)
Second Token(word) is "man" PreviousToken(P revious word) is "Every"
Third Token(word) is "has" PreviousToken(P revious word) is "man"
and so on..

how to go over the text file sequantioly to get all (two) words from file

like in example to get "Every man" then get "man has" then "has a" then "a price"
and so on

please I need help
May 17 '08 #1
1 1103
Laharl
849 Recognized Expert Contributor
Read the contents into one string (use read() once) and use the string method split(), which returns a list of all the whitespace delimited tokens.
May 18 '08 #2

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

Similar topics

5
11024
by: David Webb | last post by:
The problem started when the Working Folder for a project was somehow set to the folder of another project. I set the correct working folder in VSS and deleted the .vbproj files that had been created in the wrong folder on the hard drive. Before I discovered these files, .NET kept trying to create a new project with _1 following the project...
11
2582
by: mkarja | last post by:
Hi, I'm trying to figure out how to read some range of rows from a file. Is it possible to search the file with some criteria and then when the search string is found read 3 rows before and after that row from where the search string was found ? Of course the row where the string was found should also be read. I have a log file in txt...
14
14284
by: vince | last post by:
Can I add (append) to an xml file that already contains a serialized object, and be able to deserialize to either or both objects from the same file...??? How is this done...?? thanks, vince
19
3733
by: Alan Silver | last post by:
Hello, I have been developing ASP.NET with a text editor so far (better way to learn initially), and have now been trying Visual Web Developer. I want to create a project for an existing site and add the files to it. I can add my .aspx and .cs (code-behind) files, but VWD doesn't know which .cs file si the code-behind for any particular...
18
1857
by: jparus | last post by:
Hello, can anybody explain me how to port FILE structure into other languages. I have an DLL library and functions in this library take FILE* as a parameter. I want to make an interface into Delphi, thus I must "export" function names and parameters of the function. It is easy for usual data types and structures but I don't know how to port...
10
1646
by: Ben Sehara | last post by:
Hi, I want to include three php files in index.php file like the code below. But it always shows up only two, any two of the three, any order. <tr> <td><?php include ("includes/documents.php"); ?>&nbsp;</td> </tr> <tr> <td><?php include ("includes/locations.php"); ?>&nbsp;</td>
3
1849
by: andersond | last post by:
I have a PHP file that usually sends an email. Instead, it now simply displays the code beginning with line 14 (where #eol= begins). Can anybody help me with this? <?php #Change only the information after the equals sign $to = $_REQUEST; $body = "Your request to bind the submission on ".$_REQUEST." has been received by...
7
1832
by: mohi | last post by:
hello everyone, i have a program where i write a structure of 1020B to a file a number of times and in the next run of the program i have to again write those structures but by taking some count from the last structure written on the file so i write it like: fstream file("xyz",ios::out|ios::in|ios::ate); long pos=file.tellg();
1
47390
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or...
8
28341
blazedaces
by: blazedaces | last post by:
So I have a program below which writes an excel file with multiple sheets based on inputs of sheet names, data, cell types, etc. It uses Apache POI, which is currently the only thing I found (correct me if I'm wrong about this) that can write excel 2007 files. The program works. I've tested it out on very small files (I will include the...
0
7701
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7615
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7979
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
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 we have to send another system
0
940
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.