473,385 Members | 1,337 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,385 software developers and data experts.

To Find and extract the text

3
Please help me to find a certain text and extract the line below it to a document using C++ coding.

Thank you
Sep 29 '06 #1
3 1695
Banfa
9,065 Expert Mod 8TB
I suggest that you

a. Specify you problem more rigerously

b. Have a go at it yourself and then ask specific questions about the problems you are having.
Sep 29 '06 #2
solver
3
The problems is I am trying to extract a text from a text file
e.g
mark
4236 4231 4236 4131 0216 4131
4236 4231 4236 4131 0216 4131
4236 4231 4236 4131 0216 4131

mark
5236
64236 4231 4236
4236 4231 4236
4036 0231 0236 4131 0216 4131

the program has to extract the first line follwing the word mark

follwing is the code snippet which i am trying
#include<stdio.h>

#include<fstream.h>
#include<string.h>
#include<conio.h>

void main()
{
clrscr();
char ch;
char MARK;
ifstream infile("ECHO.TXT");
while (infile)
{
infile.seekg(MARK);
infile.get(ch);
cout<<ch;
}
getch();
}
Sep 30 '06 #3
D_C
293 100+
You don't ever define what char MARK equals. It's garbage at this point.

Is "mark" always going to be the only text on a line? In that case, open the file and read line by line. String compare each line to "mark". If you find it, get the next line of text. If it's not the EOF, then that's your extracted text. You can print it, write it to another file, or do whatever you please.
Sep 30 '06 #4

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

Similar topics

2
by: Faz | last post by:
I am trying to extract text before a certain character appears in a string. This character is the letter "C". Here is some sample data - the field is called REFERENCE_2: REFERENCE_2...
2
by: Bryan_Cockrell | last post by:
Hi World, I am extracting text from an ebcdic header using dd in the cygwin environment (bash/ksh) as below in order to rename the file to something intelligent. I'm using a specific string...
1
by: Alberto Sartori | last post by:
Hello, I have a html text with custom tags which looks like html comment, such: "text text text <p>text</ptext test test text text text <p>text</ptext test test <!-- @MyTag@ -->extract...
0
by: wbw | last post by:
I am trying to extract capitalized words from text in Excel. I have a list of a combination of brands and products and I am trying to extract out the product attribute from the text. Since the text...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.