Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please wrote code in C# Question 1. (50 Points) You will write a program that will read a text file, process it, find the ipv4

image text in transcribed
please wrote code in C#
Question 1. (50 Points) You will write a program that will read a text file, process it, find the ipv4 number in the package and write it to another text file. "LOGFILE.TXT" and "SamleOUTPUT.TXT" files are given to you. The output of this program or your answer shall be the same as the contents of SamleOUTPUT.TXT". Please follow these steps: a. Use the given "LOGFILE.TXT" i. Open the file in your code using FileStream and StreamReader Classes, ii. As we discussed in the class, StringBuilder Class is designed to store strings effectively and fast so, 1. Create a StringBuilder Object 2. Read everything from the file and store in this object using the Append Method of this object inside a while loop b. StringBuilder Objects are good at storing effectively but not good at string operations. For example, they don't have Split method that comes with string Class i. So copy StringBuilder's data to a simple string object, e.x. (String input = sb.ToString():) c. Create a char array such as (char[] h = ?!!".7"):) .these are the list of delimiter that will be used to parse the file. d. Create a string array to store the result of parsing. ( String[] p;) e. Do the parsing (p = input. Split(h): ) f. Write a for loop that will check every element in array p and find the ones with the 's in them. i. For each, you can use Indexof method such as if(p[i].IndexOf('.)!=-1) this means that there is . in the element. ii. But some elements have dots but not numbers ii. Parse again using' as the delimiter. iv. Check each parsed element whether it is a number and

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions