Purchase Solution

Extracting a certain text file from a file

Not what you're looking for?

Ask Custom Question

See the attached file.
I have a text file containing sentences and random sequences of letters, symbols and numbers. I have to write a program that will extract only the text sent to a particular device and ignore the rest of the messages. Each message sent has an identifying two characters header (first being a $ followed by a single character) followed by a two digit number indicating the size of the message followed by the message itself. I have to extract out only the set of messages (lines of text) addressed to me. Ex) My identifying two characters is $Y so the program will only extract messages sent to $Y devices.

Example input:
oprfjiad093$X5abcdep0qj3 fqijfpiqjef$Y21Your message to find.p9iqjv0$Ea0n wq9r r$Y13Next Message.09q 4r9 qefkjad0fu8;lkfdv98

Example output:
Your message to find.
Next Message.

I figured out how to store the text from the text file into a character array and display said text. I just can't find out to control what characters get displayed. Is there a special if statement or something? An example of something like this would be appreciated.

Purchase this Solution

Solution Summary

This solution gives an outline for this problem. It goes through some basic techniques that can be used in file processing, and provide a rough algorithm on solving this particular problem. There is no source code attached.

Solution Preview

You need to write a loop for this one. I will give you the algorithm and some hints, and you can try to work it out from there.

The idea is to use InputFile.get(). Do not read them all at once because you never know whether the message.txt will contain less than 1174 characters or not.

Instead, read from the beginning one char at a time. ...

Purchase this Solution

Free BrainMass Quizzes
Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

C# variables and classes

This quiz contains questions about C# classes and variables.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.